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
5.3K members online now
5.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

Can someone help me with cross-domain tracking?

[ Edited ]
Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

I'm testing on cross-domain tracking, and couldn't get it to work as expected. Could someone kindly help?

Question one:

I'm seeing multiple _ga on my site. One for the domain and one for the subdomain. I do have the traffic sent to 2 different GA account. Could that be the reason? Is there a problem here? Here's the link to my testing site: https://sunflower.pike13.com

Screen Shot 2017-06-02 at 11.33.22 AM.png

 

Question two:

After doing the referral exclusion list and setting cookie domain to auto, I'm still seeing the domain show up as referral source, what other reasons can it be?

 

Question three:

This is the error I'm seeing. I did see _ga got passes through, but there's still a new session start. What should I change there?

Screen Shot 2017-06-02 at 1.54.01 PM.png

 

1 Expert replyverified_user

Can someone help me with cross-domain tracking?

Top Contributor
# 2
Top Contributor

Hi :-)

if you are trying to track between pike13.com to subdomain sunflower.pike13.com

it would usually be a subdomain tracking setup you are after.. not cross domain tracking.. 

for subdomain tracking, code with the same tracking id needs to be installed on both the parent and child domain and the cookieDomain should be set to auto.

Only the parent domain need be on the referral exclusion list (it automatically covers the subdomains as well)

You should then setup a new View and apply the following filter:
Custom Advanced Filter:
Field A > Hostname > (.*)
Field B > Request URI > (.*)
Output > Request URI > $A1$B1

This prepends the hostname to the Request URIs in the reports, so as to be able to track which domain/subdomain a pageview etc has occured on

 

If you have further questions pls post back

Thanks

Bronwyn

Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here

Can someone help me with cross-domain tracking?

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭

Hi Bronwyn,

 

Thank you so much for your reply. I did set cookieDomain to auto and the exclusion list. But still seeing the 2 _ga. What's nice is that the 2 _ga actually have the same userid based on my reading. It's just they are under 2 subdomains.

 

I'm wondering if that's the reason why my cross-domain tracking is not working. The 2 domains I'm crossing are sunflower.pike13.com & ruizhang51100.com.

 

This is the tracking code I have on my 2 sites. (I hide my ga property id)

<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-******', 'auto', {'allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', ['pike13.com', 'ruizhang51100.com'] );
ga('send', 'pageview');

</script>

 

Best,

 

Rui

Can someone help me with cross-domain tracking?

Top Contributor
# 4
Top Contributor

Hi :-)

I just realized, you are using GTM is that correct?
How are you adding the tracking?
Are you using a Universal Analytics tag via GTM?

If so, you should probably look over the following article
http://www.lunametrics.com/blog/2015/06/16/cross-domain-tracking-with-google-tag-manager/

 

 

 

Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here

Can someone help me with cross-domain tracking?

[ Edited ]
Visitor ✭ ✭ ✭
# 5
Visitor ✭ ✭ ✭

Hi Bronwyn,

 

Yes, I used GTM under one site - sunflower.pike13.com

But I used custom HTML tag to just embed the code.

 

And under ruizhang51100.com, I embedded the code under the header. 

 

I also attached another screenshot if that's helpful.

 

Best,

 

Rui

Can someone help me with cross-domain tracking?

Top Contributor
# 6
Top Contributor

 

On the sunflower subdomain

 

<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-XXXXX516-1', 'auto', {'allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', ['ruizhang51100.com'] );
ga('send', 'pageview');

</script>

 

on ruizhang51100.com

<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-XXXXX516-1', 'auto', {'allowLinker': true});
ga('require', 'linker');
ga('linker:autoLink', ['sunflower.frontdeskhq.com', 'sunflower.pike13.com'] );
ga('send', 'pageview');

</script>

 

on the Referral Exclusion List
sunflower.frontdeskhq.com

ruizhang51100.com

sunflower.pike13.com

Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here

Can someone help me with cross-domain tracking?

Visitor ✭ ✭ ✭
# 7
Visitor ✭ ✭ ✭

That's what I did as you can see if you inspect the page.

What's weird is that as you can see in the last screenshot, the _ga did pass to the new site in the url, but it's still counted as a new session.

 

I was also testing on another 2 sites for my client, and that one works perfectly fine.  I just can't get this one to work Smiley Sad

Can someone help me with cross-domain tracking?

[ Edited ]
Top Contributor
# 8
Top Contributor

Make sure to clear your cookies each time you retest.

edited

What sort of redirect is in place, redirecting sunflower.frontdeskhq.com to sunflower.pike13.com?

a 301 perm redirect?

 

Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here

Can someone help me with cross-domain tracking?

Visitor ✭ ✭ ✭
# 9
Visitor ✭ ✭ ✭

Yup, I cleared everything during testing. It's regular 302 redirect.

Can someone help me with cross-domain tracking?

Top Contributor
# 10
Top Contributor

I would test with the redirection changed to a 301 instead of a 302.
I have a feeling it is an issue with the redirection (at least in part)

Were it me setting this up, I would be going about it in a different manner,

mainly for the sake of setup/config. consistency

 

 

Bronwyn Vourtis, Google Analytics Top Contributor
Was my response helpful? If yes, please mark it as the ‘Best Answer.’ Learn how here