4

On my website we don't get any e-commerce tracking in Google Analytics. Usual analytics works fine. How do I troubleshoot?

Have sold around 200 products since installing & configuring the Google Analytics and Commerce Analytics modules.

The module maintainers haven't replied on the same request on drupal.org https://www.drupal.org/node/2612390

Cheers,

EDIT: I updated from Commerce Analytics from 7.x-1.1 to 7.x-2.0-beta2. Still nothing in Google Analytics, but now ga_push appears in source code.

enter image description here

15
  • Which method are you using? Client-side or server-side?
    – nvahalik
    Commented Nov 18, 2015 at 11:35
  • Not sure - how do I check that? I've got the google analytics module with our GA ID in the configuration and the Commerce Analytics added on top. Commented Nov 18, 2015 at 11:37
  • Did you set up rules to fire off events? If so, you're using server side.
    – nvahalik
    Commented Nov 18, 2015 at 13:36
  • I didn't set up any rules, but there's the folowing rule active which I guess comes from the commerce analytics module? { "commerce_google_analytics_rule_ga" : { "LABEL" : "Send google analytics code on checkout completion", "PLUGIN" : "reaction rule", "OWNER" : "rules", "REQUIRES" : [ "commerce_google_analytics", "commerce_checkout" ], "ON" : { "commerce_checkout_complete" : [] }, "DO" : [ { "commerce_google_analytics_send_order" : { "commerce_order" : [ "commerce_order" ] } } ] } } Commented Nov 18, 2015 at 13:38
  • Any thoughts @nvahalik? Commented Nov 23, 2015 at 20:26

1 Answer 1

3
+25

What method are you using to Push? Configuring the rule, you can select it at the bottom of the edit page:

enter image description here

I just tried it with Analytics.js support and the checkout page appears to display the Analytics code:

<!--//--><![CDATA[//><!--
var ga = ga || [];
ga('require', 'ecommerce', 'ecommerce.js');
ga('ecommerce:addTransaction', {"id":"5","affiliation":"Commerce Kickstart","revenue":16,"currency":"USD","tax":0,"shipping":8,"city":"Austin","region":"Texas","country":"United States"});
ga('ecommerce:addItem', {"id":"5","sku":"MG2-YLW-OS","name":"Coffee Mug 2","category":"Product: drinks","price":8,"currency":"USD","quantity":1});
ga('ecommerce:addItem', {"id":"5","sku":"shipping","name":"Standard shipping: 3 - 5 business days","category":"Shipping","price":8,"currency":"USD","quantity":1});
ga('ecommerce:send');

//--><!]]>

This appears to be correct. One of the difficulties with testing GA for Commerce is that they do not show up in realtime.

So, I'd try it with Analytics.js if you aren't currently using that method and ensure that something like what you see above is being included on the page. If it isn't, then something isn't working on the site side. If it displayed, then check your JS console for errors to see if something else happened. You can also open up the Network tab and ensure that you're seeing the calls to "collect":

enter image description here

1
  • This worked! Really appreciate the time you've spend my issue here. Hope I'll get serverside working at some point too;) Commented Jan 7, 2016 at 14:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.