I recently upgraded this plugin to replace the old version from last year. Enhanced Ecommerce isn't working for me. I'm viewing the Shopping Behavior Analysis report and all the numbers are zero except Sessions. Product views, add to cart, checkout, and transactions are zero. Regular Universal Analytics data is still being collected as before the upgrade, including ecommerce transaction data on other reports.
I checked that all the catalog files are in place, and I did all the core files merges.
When I view the page source from a browser, here are the snippets in the source, with account number and widget names sanitized.
This is in my product page HEAD.
Code:
<script type="text/javascript"><!--//
(function(i,s,o,g,r,a,m) {i['GoogleAnalyticsObject']=r;i[r]=i[r]||function() {
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-xxxxxx-2', 'auto');
ga('require', 'displayfeatures');
ga('send', 'pageview');
//--></script>
This is my add to cart button.
Code:
<!--bof Add to Cart Box -->
<div id="cartAdd">
Quantity: <input type="text" name="cart_quantity" value="1" maxlength="6" size="4" /><br /><br /><input type="hidden" name="products_id" value="3569" /><input type="image" src="includes/templates/mistik/buttons/english/btn_add_cart_green.gif" alt="Add to Cart" title=" Add to Cart " onClick="_gaq.push(['_trackEvent', 'Cart', 'Add to Cart', 'Product Page']);" /> </div>
<!--eof Add to Cart Box-->
This is before /BODY.
Code:
<!-- ===== Google Enhanced Ecommerce - Product Information ===== -->
<script><!--
var arrInputTags = document.getElementsByTagName('input');
var i = 0;
var sFound = "false";
var intLength = arrInputTags.length;
while ((sFound == "false") && (i < intLength)) {
if (arrInputTags[i].getAttribute("title") == " Add to Cart ") {
sFound = "true";
}
if (sFound == "false") { i++ }
}
function geeAddToCart() {
var myQuantity = document.getElementsByName('cart_quantity')[1].value.valueOf();
ga('ec:addProduct', {
'id' : '2444',
'name' : 'Widget name',
'price' : '49.4000',
'quantity': myQuantity.valueOf()
});
ga('ec:setAction', 'add');
ga('send', 'event', 'UX', 'click', 'add to cart'); // Send data using an event.
}
if (sFound == "true") {
arrInputTags[i].addEventListener("click", geeAddToCart);
}
--></script>
<script><!--
ga('ec:addProduct', {
'id': '2444',
'name': 'Widget name',
'price': '49.4000',
});
ga('ec:setAction', 'detail');
--></script>
What am I missing? Is there something else I need to set up within GA for it to recognize the add to cart actions etc?
Bookmarks