How to use Google Analytics to track a development and production versions of the same site on different servers?
Posted
by
Abe
on Pro Webmasters
See other posts from Pro Webmasters
or by Abe
Published on 2012-10-03T22:45:39Z
Indexed on
2012/10/04
3:54 UTC
Read the original article
Hit count: 375
google-analytics
|tracking
I have a website with two versions, one for production and one for development (testing new features). All of the code is under version control and the websites are on separate servers.
Currently, I have the same Google Analytics Tracking code used on both sites. Since the code is under version control, it would be ideal to either have an if I am on production, use this code; else if on development server use that code
clause. But I suspect that Google makes it easier to do something like this.
I see that there are many ways to configure a GA tracking code, e.g. "a single domain" vs. "multiple top level domains". But it is not clear to me how to set this up.
Also, if tracking code configured for a single domain has been on the development server, have I been picking up traffic to both sites, or does GA just ignore the second domain that I haven't registered?
© Pro Webmasters or respective owner