With Universal analytics, what are the best practices in sending/testing data to a test profile?
I've included the tracking snippet before the </head>
and the following:
window['ga-disable-UA-XXXXXXXX-X'] = true;
ga('create', 'UA-XXXXXXXX-X', {
'cookieDomain': 'none'
});
ga('send', 'pageview');
I'll usually handle this by always keeping the same code in production vs staging (aka remove the ga-disable
and cookieDomain
lines of your code snippet). I then create 2-5 different views in Google Analytics and filter them as:
^(www\.)?example\.com$
)test.example.com
)staging.example.com
)admin.example.com
)Under Profile >> Filters there are predefined filters and custom filters. Use a predefined include Traffic to the Domain
for all of the above.