Google Analytics and Forum as a subdomain, how to avoid duplicate data?

Pavle123

Active member
Hello,

I have my forum as a subdomain at www.forums.example.com and have my site as obviously example.com.

I am using WP if that means anything as a main site CMS.

The G.Analyics code I have for my site I used as to add to XenForo.

I start to see that my main site is not acting as a referal, and some pages such as home page is being duplicated.

How to fix this?

Can anyone with a forum as a subdomain help me out please, this is the one last thing I want to set up for my forums.
 
I read everything in these two articles

https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSite

https://support.google.com/analytics/answer/1033876

And from what I understood I will have to modify the code for both of my CMS.

Tracking Across a Domain and Its Subdomains

Asynchronous syntax

<script>var _gaq = _gaq ||[];
_gaq.push(['_setAccount','UA-12345-1']);
_gaq.push(['_setDomainName','example-petstore.com']);
_gaq.push(['_trackPageview']);</script>

This above is obviously what I have to modify

And bellow is what I have

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

ga('create', 'UA-77984534-1', 'auto');
ga('send', 'pageview');

</script>

My question is how do I combine these two? How should an entire code look like?
Can anyone try to help me out on this, I am still struggling with the setup.

Thanks.
 
Still confused about this. I have set up the same tracking both in XF and WP, it seamst to work, but still it shows strange data, such as referrals, inaccurate homenpage (both homepage of WP and XF a appear as / )
 
I have´t been able to find a solution to this, can anyone help?

To sum up everything from above :
How do you handle GA forum and website tracking if they are on a subdomain?
Do you create separate properties, or you track all in 1? If you do track all in 1 do you use the same code? Are any resource additions required for GA tracking?
 
Back
Top Bottom