google-analyticscross-domainanalyticsgoogle-tag-manageranalytics.js

Custom Campaign tracking Cross-Domain Google Analytics


I have successfully implemented Cross-Domain tracking with Google Analytics (1 session as user jumps across domain, same _ga cookie on both domains, etc.) However, when the user jumps to the second domain and completes a purchase, the eCommerce transaction is not getting attributed to the utm custom campaign from the first page. It seems you can't pass the utm custom campaign information cross-domain. Is this true? Has anyone ran into this before?


Solution

  • I found my issue, cache. I have done hard refreshes before every test, but I went into Chrome tools and clear EVERYTHING. Cookie, cache, everything. And Cross-Domain tracking for Custom Campaigns started working! For reference here are the scripts for the two sites:

    Site 1:
    
    ga('create','UA-xxxxxxx-x'','auto', { 'allowLinker': true });
    ga('require', 'linker');
    ga('linker:autoLink', ['site2.com']);
    ga('require','ecommerce','ecommerce.js');
    ga('send','pageview');
    
    Site2:
    
    ga('create', 'UA-xxxxxxx-x', 'auto', { 'name': 'client', 'allowLinker': true });
    ga('client.require', 'linker');
    ga('client.linker:autoLink', ['site1.com']);
    ga('client.require', 'ecommerce', 'ecommerce.js');
    ga('client.send', 'pageview');

    Also, I added site1.com and site2.com to the Referral Exclusion List in GA and the UA key for site 1 and site 2 are the same.