Your Google Analytics data is supposed to be your guiding light for what’s working on your site. But when that data is muddied up by bots, how are you supposed to get a true analysis? Time to make the GA spam filter of all filters!
To get started, you’ll need Google Analytics*** and Google Tag Manager.
Let’s get into it:
STEP 1: Set a Custom Dimension Within Your UA Variable in GTM:
- Create a User Defined Variable for your Google Analytics property ID. Go to “Variables” in the left-hand navigation, select “Google Analytics Settings” in the Utilities section, then add your Universal Analytics Tracking ID (UA-XXXXXXXXX-X) in the “Tracking ID” field.
- Set a Custom Dimension for Container ID in Your User Defined Variable. Your GTM container ID should look like this: GTM-XXXXXXXX. Set a custom dimension within the user defined variable. Hit the “Custom Dimensions” button, use “1” as the Index number (if this is the first custom dimension you’ve created). In the “Dimension Value” field, add {{Container ID}}.
STEP 2: Register Your New Custom Dimension in Google Analytics
- Set Your Custom Dementions in GA UA. Go to the Admin section, Within the Property settings, hit “Custom Definitions,” click on “Custom Dimensions,” then, hit the “New Custom Dimensions” button. Create a hit-scoped dimension with the name “Container ID” using the sameindex you used in GTM.
STEP 3: Create The Filter!
- (Create this filter first in a Test View!)
- Go to the GA Admin section. Hit “Filters,” then hit “Add Filter,” hit “Include” for the filter type, and set “Container ID” as your Filter Field, add your GTM container code as the Filter Pattern.
Boom! You’re on your way to more accurate traffic. Check out Root & Branch Group’s full post and easy video tutorial all about this spam filter!
***NOTE: You will need the Universal Analytics (UA) property type for this to work. GA4’s current limitations on filters can’t do it.