I'm having a problem with Google Analytics Traditional tracking between my site and my Shopify.com storefront. Ultimatelly, my Analytics account is NOT showing any eCommerce, page-views etc from Shopify.com.
I've conducted a variety of tests between my website and Shopify.com's:
I did have a successful transaction that recorded in my GA account a few weeks ago but I haven't been able to replicate it again (using the same methods you see below, with the same product, using Chrome).
Shopify.com still uses the old traditional Google Anlaytics tracking script so I changed my GA script on mysite back to the following trad script:
<script type="text/javascript">
var pageTracker = _gat._getTracker('UA-XXXXXX-X');
pageTracker._setDomainName('.mysite.com');
pageTracker._setAllowLinker(true);
pageTracker._trackPageview();
</script>
And the inline code from mysite.comis, linking to the Shopify.com store page (bypassing the shopping cart):
<a href="http://mysite.myshopify.com/cart/XXXXXXXXX:X" onclick="pageTracker._link('http://mysite.myshopify.com/cart/XXXXXXXXX:X'); return false;" alt="Buy Product">BUY NOW </a>
Shopify's GA Code renders as the following and I only have the ability to update the UA ID# and ADD custom variables (as you can see I did with pageTracker and setDomainName below). I CAN'T DELETE or modify the script other than that though.
<script type="text/javascript">
var pageTracker = _gat._getTracker('UA-XXXXXX-X');
pageTracker._addDevId('XXXXX');
pageTracker._setAllowLinker(true);
pageTracker._setDomainName('none');
try{pageTracker._setDomainName('.mysite.com');}
catch(e){};pageTracker._trackPageview();
</script>
As you can see from the Shopify.com receipt page code below, the data I is getting passed and it's registering $, setDomainName twice: once with .mydomain.com and a second with "none". BUT--Unfortunately it's not registering in my GA account.
<script type="text/javascript">
var pageTracker = _gat._getTracker('UA-XXXXXX-X');
pageTracker._addDevId('XXXXX');
pageTracker._setAllowLinker(true);
pageTracker._setDomainName('none');
try{pageTracker._setDomainName('.mysite.com');
}catch(e){};
pageTracker._trackPageview('/checkout/orders/show');
<script type="text/javascript">
pageTracker._addTrans("#1270", "MySiteName", "5.00", "0.00", "0.00", "City", "State", "United States");
pageTracker._addItem("#XXXX", "SYMXXX", "Product Name", "ProjectCategory", "5.00", "1");
pageTracker._trackTrans();
Any thoughts?
I'm wondering if the first setDomainName on Shopify.com (that I don't have control of) is negating the second that I've added. I'm going to test what's above without adding the additional "pageTracker._setDomainName('.mysite.com');" on Shopify, but I thought I'd reach out also since my last dozen or so tests have not generated the results I want.
Thanks in advance for the help!!!
_setDomainName just tells the Google Analytics cookie where to store itself. It sounds like you're trying to set the domain as .mysite.com from a shopify domain like mystore.shopify.com. Cookies can't be set across domains like this for security reasons. Try leaving gat._setDomainName('.mysite.com') on you main site and gat._setDomainName('none') on your shopify store.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With