How do you exclude yourself from Google Analytics on your website using cookies?

There's nothing in your question about the second step of the process. The code you're using should just set a custom variable that will be sent to GA with the rest of the tracking data. You need to then set up a filter to exclude data where the variable is set to "test_value".

To create the filter , go to the "Analytics Settings > Profile Settings" screen and click on "Add Filter". In the screen that comes up use the following settings:

  • Add new Filter for Profile
  • Filter Name: Exclude own Traffic
  • Filter Type: Custom filter
  • Click the "exclude" radio button
  • Filter Field: User Defines
  • Filter Pattern: test_value
  • Case Sensitive: No

On a side note, remember that to set the custom variable you need to add the code to your page, run it then remove it. If you don't remove it then a cookie will be set for all visitors and they will all be excluded. It's best to set up an additional profile to test that the filter is working properly before applying it to your main profile as historical data can't be retrieved if you set it up wrong.


A way to do it without cookies is by using an extension: http://www.igorware.com/extensions/block-yourself-from-analytics I like this because

  • I have the extension installed in Chrome so it is available across my devices
  • it is easy to setup
  • I don't need to create a hidden page that sets the cookie or change a real page temporarily.
  • If I erase my cookies I don't need to remember to re-enable them.

This is Google's official plugin for all the most common browsers, which will exclude you from Google Analytics:

https://tools.google.com/dlpage/gaoptout

Have all your team members install it.

PS: The issue with the IP-based filtering method is dynamic IP address allocation.