AdWords is now Google Ads. Our new name reflects the full range of advertising options we offer across Search, Display, YouTube, and more. Learn more

Analytics
4.4K members online now
4.4K members online now
Dive into multiple domain (Cross/Sub) tracking, implementing Ecommerce and Enhanced Ecommerce, setting up Event tracking, and Universal Analytics code.
 
Guide Me
star_border
Reply

Please Help Cross domain tracking

[ Edited ]
Explorer ✭ ✭ ✭
# 1
Explorer ✭ ✭ ✭

Hello All,

I have a question regarding cross domain tracking in GA.

Suppose I have two domains abc.com and xyz.com in which I want to implement Cross domain tracking using normal GA universal code.I am not takling about implementing with GTM here.

 

The single GA id is UA-123456-1 which is implemented in both two domain

 

Now in the abc.com

 

I have put this code below:


<script>
(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','https://www.google-analytics.com/analytics.js','ga');


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

</script>


-------------------------------

Now in the xyz.com

I have put this code below:


<script>
(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','https://www.google-analytics.com/analytics.js','ga');


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

</script>


------------------
Now after that i added abc.com and xyz.com in referral exclusion list.


Now did i implement all right?

Please answer

1 Expert replyverified_user

Please Help Cross domain tracking

Rising Star
# 2
Rising Star

Hey Soumik,

 

This should work fine... I didn't look at your entire syntax, but yes all the elements are there.  One thing to note is that this works for straight HTML.  If someone decided to be cute and code the buttons with JS, then the autolink will not work and you'll have to do some coding gymnastics or tell the dev team to just do a regular href.  Smiley Happy

 

It's super easy to test this, you should see the cid appended to the URL when you land on the destination page and you can use the Chrome Plugin GA Debugger.

 

-Theo

Analytics Evangelist at MoreVisibility | Contact Me
Connect on LinkedIn

Please Help Cross domain tracking

Explorer ✭ ✭ ✭
# 3
Explorer ✭ ✭ ✭

Thanks .Just one thing Theo.

 

I have implemented a demo cross domain linking in these two domain for test purpose only:

http://whatmynation1.blogspot.in

 

http://whatismynation2.blogspot.in

 

If you go here:http://whatmynation1.blogspot.in you can see a link to go http://whatismynation2.blogspot.in/2017/04/what-is-my-nation2.html

Can u please just check if i set up cross domain all right?

Just help one buddy.I am not able to see any cid here

 

 

 

Please Help Cross domain tracking

Rising Star
# 4
Rising Star

Hey Soumik,

 

Looks good (on the surface Smiley Happy ) .  The client id is here:

 

http://whatismynation2.blogspot.in/2017/04/what-is-my-nation2.html?_ga=1.260884879.360289850.1492712...

 

in this info  _ga=1.260884879.360289850.1492712669

 

Smiley Happy

 

Best,

 

Theo

Analytics Evangelist at MoreVisibility | Contact Me
Connect on LinkedIn

Please Help Cross domain tracking

Explorer ✭ ✭ ✭
# 5
Explorer ✭ ✭ ✭

Thanks for the reply