Apply a Hostname Filter for Development and Staging Servers

Hostname filterview at full size

You can apply define a filter based that limits profile data to a specific hostname.

If is likely that your Google Analytics tracking code resides, along with everything else that constitutes your website, on a development or testing/staging server before you deploy it to your production server.

To include or exclude Google Analytics data that is generated on any server, you can apply a profile filter that specifies the exact version of your domain, such as:


For profiles that should contain production data only, a best practice is to apply an include filter for your production domain only:


As a general note, once you define an include filter for hostname (or any other dimension), all other versions of the hostname will be excluded, so there’s no need to apply a hostname include and an exclude filter to the same profile.

Also note above that the \ serves as the regular expression “escape” character so the dot is interpreted as a literal dot and not as a wildcard match single character.

Please share this post:
Facebook Twitter Plusone Linkedin Email

If Cross-Domain Tracking Is Working, Google Analytics Generates a Single Set of Cookies

Single Set of Google Analytics Cookiesview at full size

If cross-domain tracking is implemented correctly, Google Analytics generates cookies only for the first domain accessed.

A basic test for cross-domain (and cross-subdomain) tracking is that the first domain that a visitor accesses generates Google Analytics cookies but that the domain or subdomain that is linked to does not.

A separate set of cookies would undermine the very principle of cross-domain tracking. If and are to be integrated in Google Analytics profiles, data such as visit count must be read from a single __utma cookie, source must be read from a single __utmz cookie, and sessions must be managed with a single __utmb cookie.

For more on implementing cross-domain and subdomain tracking, see Google Analytics developer help.

Please share this post:
Facebook Twitter Plusone Linkedin Email