Question

From google's documentation:

The analytics.js snippet is part of Universal Analytics, which is currently in public beta. New users should use analytics.js. Existing ga.js users should create a new web property for analytics.js and dual tag their site. It is perfectly safe to include both ga.js and analytics.js snippets on the same page.

However, I can't seem to find a way to set up a filter to exclude my own traffic with a cookie. There is this for ga.js, but as far as I can tell there is no way to set a custom variable with analytics.js, and I get get a custom dimension to work.

Edit: What I've done thus far:

  1. Set up a custom dimension called 'ignore' in GA via the UI
  2. Created a filter specifying the custom dimension from step 1
  3. called ga('set', 'dimension1', 1); my website

traffic is not ignored

Was it helpful?

Solution

Why not just set your own cookie and check against it using the opt out var?

window['ga-disable-UA-XXXX-Y'] = true;

OTHER TIPS

Note: This should work, but for some reason it does not. I was hoping someone could improve on this

  1. Set up a custom dimension called 'ignore' in GA via the UI
  2. Created a filter specifying the custom dimension from step 1
  3. call ga('set', 'dimension1', '1'); before ga('send', 'pageview');

Another option is the Google Analytics Opt-out Browser Add-on. It will disable tracking for all sites though.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top