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


Active member

I have my forum as a subdomain at and have my site as obviously

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.


Active member
I read everything in these two articles

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 ||[];

This above is obviously what I have to modify

And bellow is what I have

(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),

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


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.



Active member
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 / )


Active member
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?