Analytics
1.9K members online now
1.9K members online now
Ask questions about filter set-up and issues with using filters in Google Analytics reports
 
Guide Me
star_border
Reply

GA - Different domains / cross domain tracking

Visitor ✭ ✭ ✭
# 1
Visitor ✭ ✭ ✭

Hello,

 

I have two domains: 

 

I'd tried to follow this tutorial: https://support.google.com/analytics/answer/1034342?hl=en

 

In fr.example.com header I put this tag:

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

In www.example.com header I put this tag:

 

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

In Example.com property, I have three views:

 

 

In fr.example.com I added this filter:

addfilterview-fronly..JPG

 

In www.example.com I added this filter:

 

addfilterview-wwwonly..JPG

Could anyone tell me if this is the right way to do it?

Thanks in advance!

1 Expert replyverified_user

Re: GA - Different domains / cross domain tracking

Rising Star
# 2
Rising Star
Hi Anthony,

fr. is just a subdomain of your domain so you actually have the same domain and cross-domain tracking is not required.


the filter you are using simple prepends the hostname into the content reports and would only be required on the one view that contains the top level domain and the subdomain. If you want to see these in different views, just create "include" filters for two additional hostnames.

One matching fr.example.com and one matching "begins with" example.com (or regex ^example\.com) or www.example.com depending on how your site is configured.

I would post screenshots but there is a problem with some users (I'm one of them Smiley Sad ) here on the forum.

Best,

Theo
Analytics Evangelist at MoreVisibility | Contact Me
Connect on LinkedIn

Re: GA - Different domains / cross domain tracking

Visitor ✭ ✭ ✭
# 3
Visitor ✭ ✭ ✭
Hey Theo!

Thanks for this answer. Unfortunately, my english doesn't help me to understand your answer properly, but I manage to see that this tuto is not the right one for subdomain. I'll try to follow this one http://www.verticalrail.com/kb/filter-in-google-analytics-to-track-subdomains/ then.

Re: GA - Different domains / cross domain tracking

Rising Star
# 4
Rising Star
Hi Anthony,

I apologize for not being able to add screenshots as that would have helped greatly. Smiley Happy

The link you provided is fine except if you are using Universal Analytics and are using the auto function as provided under the web property>>Tracking Code then you do not need to do step 4 and set the referral exclusion.

Best,

Theo Bennett
Analytics Evangelist at MoreVisibility | Contact Me
Connect on LinkedIn