Tracking subdomains in the same profile as the main domain
Posted
by
Osvaldo
on Pro Webmasters
See other posts from Pro Webmasters
or by Osvaldo
Published on 2014-06-04T20:11:33Z
Indexed on
2014/06/04
21:44 UTC
Read the original article
Hit count: 240
google-analytics
I have a site, let's call it http://www.example.com with a non-universal Google analytics account.
Now we have to add new functionalities in a subdomain like https://subdomain.example.com as a micro site. On that subdomain the URL's will be something like https://subdomain.example.com?param1=foo¶m2=bar
We can't change the requirements as both main site and mini-site use a different CMS/application. This is strictly a Google Analytics question.
But we need to count pageviews and events that happen in that subdomain (with URLs like https://subdomain.example.com?param1=foo¶m2=bar) as belonging to the main domain. So pageviews and events in https://subdomain.example.com?param1=foo¶m2=bar need to be recorded as if they happened in http://www.example.com/path/to/whatever/I/want
Fortunately we have full control on JavaScript in the main domain site and in the subdomain site too.
How can we make this work? Do we need to change tracking code both in the main domain and subdomains? Do we need to reconfigure Google Analytics?
Please note again that we do not want to create a new view for the subdomain. Both mini-site and main site should be in the same account, property and view.
© Pro Webmasters or respective owner