Analytics
2.3K members online now
2.3K 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

URGENT Please Help Cross Domain Tracking!!!

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

Hello I have two domains for test:

1>Source Domain(http://sourcexyz.blogspot.in) From this domain I want to collect data

2>Destination domain(http://destinationpqr.blogspot.in) To this domain I want to transfer source domain data .

I have implemented single UAID and tracking code FOR BOTH THE DOMAIN which is:UA-80016223-1

 

The snippet code which i have implemented in the source domain (http://sourcexyz.blogspot.in)is 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-80016223-1', 'auto', {'allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', ['destinationpqr.blogspot.in'] );

//from the domain where we want to collect  the data
ga('send', 'pageview');

</script>

 

 

The snippet code which i have implemented in the destination domain (http://destinationpqr.blogspot.in)is 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-80016223-1', 'auto', {'allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', ['sourcexyz.blogspot.in'] );

//to the domain where we want to see all the data
ga('send', 'pageview');

</script>

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

My question is did I implement all code right?From tracking point of view everything is fine and all hits are being tracked in real time.Please double check it i want to assure every thing is all right or not?

1 Expert replyverified_user

Re: URGENT Please Help Cross Domain Tracking!!!

Top Contributor
# 2
Top Contributor
Hi,

you can easily check if all works fine if you can see the _ga parameter appended to the URL when crossing domains e.g. http://destinationpqr.blogspot.in/?_ga=1.2.3.454325234634

On the other hand if both sites are on blogspot.in you do not need the cross domain support so for both sites you would just need:
&lt;script&gt;
(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-80016223-1', 'auto');
ga('send', 'pageview');
&lt;/script&gt;

Hope it helps.

Kind regards,
Zorin
Web analyst @ escapestudio.net

Re: URGENT Please Help Cross Domain Tracking!!!

[ Edited ]
Explorer ✭ ✭ ✭
# 3
Explorer ✭ ✭ ✭

Is my code ok ?YEPPE IT IS WORKING THANKS!

Thanks Buddy

Re: URGENT Please Help Cross Domain Tracking!!!

Top Contributor
# 4
Top Contributor
Yes, should work fine.
Web analyst @ escapestudio.net