I created a new Chrome Extension: Internalize for Google Analytics. This is its very first version. It only works on websites with Universal Analytics.

Click here to download Internalize for Google Analytics v1.0

The idea is that with the extension you can push a custom dimension value to your currently active session. You can then use a profile filter in GA to block traffic with this custom dimension value. It’s useful when blocking internal traffic with more traditional means (IP address or various GTM workarounds) won’t work.

How to use it

  1. Create new session-scoped custom dimension in GA property settings

  2. Make note of the index number of this new dimension

  3. Go to the website whose traffic is being tracked to the property

  4. Click the extension to open a pop-up

  5. Add the index number to its designated place in the pop-up

  6. Click the button “Enable Internalize”

This sends a non-interaction event to the active session. The Event Category is “Internalize” and the Event Action is “Enable”.

A custom dimension value “true” is sent with this event, and it is this value that you should filter in your profile settings.

The screenshot above assumes that the name of the new custom dimension is “Internal”.

How it works

The extension first checks if Universal Analytics is implemented on the page. If it is, the extension icon turns blue to indicate that it’s ready to operate.

Once you add the index number and click “Enable Internalize”, the XMLHttpRequest() object is used to send a data package to Google Analytics servers. This payload contains the following:

  1. The tracker ID of the first ‘ga’ object found on page

  2. The client ID of the first ‘ga’ object found on page

  3. The event data with the custom dimension

A cookie with a 30 minute expiration is written as well to prevent multiple pushes in a short period of time.

Upcoming features

There are some caveats right now. First of all, you can send the event to ANY Universal Analytics website, because it accesses the ‘ga’ object found on the page. This is obviously a problem, and even though there’s not too much damage you can cause with a clickable browser extension (which sends non-interaction data), it’s still annoying to see extra hits on your site.

Also, it only works with the first ‘ga’ object found on the page, so if you have multiple Universal Analytics properties tracked on a single page, this will only work on one of them.

So here’s a feature list I’ve drawn up for the near future:

  1. Add an Options panel

  2. Choose domains for which the extension will only work (now it works for all)

  3. Choose a tracker ID for which the extension will only work (it will look for this tracker ID from the ‘ga’ object)

  4. Choose whether just a cookie is set or whether the Measurement Protocol is used as well

  5. Add support for multiple tracker IDs

Working with internal traffic is a pain, and I hope this extension helps some of you with unwanted hits.

Click here to download Internalize for Google Analytics v1.0