kenold
kenold

Reputation: 318

Google Analytics Cross Domain with CoreCommerce

I would like to setup cross domain tracking. Google says the code on the the first domain should look like this.

ga('create', 'UA-XXXXXXX-Y', 'auto', {'allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', ['example-2.com'] );

For example-2.com, my URL looks like this:

https://www15.corecommerce.com/~mystore897/checkout.php?m=fastcheckout

Should my code look like this now?

ga('create', 'UA-XXXXXXX-Y', 'auto', {'allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', ['www15.corecommerce.com/~mystore897/checkout.php?m=fastcheckout'] );

Upvotes: 0

Views: 82

Answers (1)

nyuen
nyuen

Reputation: 8907

You only need to put in the domain of the secondary domain that you are tracking into

ga('create', 'UA-XXXXXXX-Y', 'auto', {'allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', ['corecommerce.com']);
ga('send', 'pageview');

Here is some more info on the autoLink plugin: https://developers.google.com/analytics/devguides/collection/analyticsjs/cross-domain#autolink

Upvotes: 1

Related Questions