In an article the other day, I wrote a trick to avoid more than 95% of Google Analytics referrer spam, and I received more response than I expected. We received many comments that it was difficult to implement because it was just a workaround . This point is also a bottleneck for me and I have not been able to move to other properties.
However, using the method presented here,
- You can continue to use the properties you have been using
- Only one filter to apply to a view is enough
- The effect is the same as the method introduced last time (only 23 spam sessions in 6 months)
Because of this advantage, it is probably the strongest method at the moment as a countermeasure against referrer spam. If you are having trouble with referrer spam, I think you should try to set it up immediately.
- It is possible to customize the tracking code
- You have admin rights on the property
- using universal analytics
- Not using up custom dimensions
I will speak under the premise that If you are stuck with any of these conditions, I would appreciate it if you could find the appropriate method to meet the above assumptions. That said, if you’re not even using up your custom dimensions, I think you’ll be fine.
Steps to prevent referrer spam
Step 1: Add Custom Dimensions to Properties
First, add a custom dimension to your property. We recommend that you select “Referrer Spam Block” as the name to add and “Sessions” as the scope.
For instructions on how to add a custom dimension , please refer to the Analytics official help Setting and Editing Custom Dimensions and Custom Metrics .
Step 2: Edit your tracking code and set values for your custom dimensions
Next, edit the tracking code. For editing , please refer to the “Collection” section of Custom Dimension/Metrics in the Analytics Official Help .
Normally, this is an item for setting an appropriate value for each user or session, but in this application, a completely fixed string is set. Also, it doesn’t matter what string you set.
ga('set', 'dimension1', 'SEM Technology Referrer Spam Block');
(make sure the dimension numbers are appropriate for the dimensions you added).
If you are using Google Tag Manager, set these in the Custom Dimensions field when submitting Google Analytics related tags.
Step 3: Add One View Filter to Fight Filters
Finally, add a filter in the “Filter” setting field in the view settings. The setting of the filter to be added is
|filter name||Referrer spam removal|
|Filter type||Custom – Match|
|filter field||Referrer spam block|
|filter pattern||SEM Technology Referrer Spam Block|
becomes. For the filter field, create the custom dimension you created, and for the filter pattern, specify the pattern string set on the tracking code.
How can this prevent referrer spam?
As I wrote in the previous article, most referrer spam does not actually visit the website, but randomly generates a Google Analytics tracking code and uses the Measurement Protocol for that tracking code. Sending page view data using At this time, for commonly used parameters (page path, referrer information, browser, language, etc.), we have specified similar values, so it is difficult to filter with those general parameters is the current situation. However, by using custom dimensions, this acts like a password, allowing you to determine if it is correct pageview data.
Is there referrer spam that this doesn’t prevent?
In conclusion, even with this method, pageviews due to referrer spam will remain. We are doing the same on this site, but currently,
6 referrer spam is measured. These spam does not mean that the character string specified in the custom dimension has been broken, but actually visited this website (access with the relevant referrer has been confirmed from the web server log) .
In this way, the current situation is that it is difficult to deal with the type of referrer spam that actually accesses the website even with this method. However, only 23 sessions of referrer spam came in with this filter setting in about 6 months (5,960 sessions for the entire site in 6 months, so the spam ratio is only 0.39%). So I think it’s a very effective tool. Also, since there are 6 spam in 6 months, it can be said that the policy of filtering each time will not be a big hassle (this will change depending on the popularity and size of the site).
Also, in my case, I installed a tag via Google Tag Manager, so I checked whether it was measured as referrer spam based on the referrer host name in Tag Manager. , If it is referrer spam, the tag will not be delivered, and we believe that the above referrer spam can also be avoided. I was. Regarding this superiority, I will publish it again after a certain amount of time has passed and the data is complete.
Filters can be written in a format similar to the lookup table above, so even if the number of targets to be filtered increases, it becomes easier to see what is being judged as spam compared to the filter function of Google Analytics. This makes it easier to do (on the other hand, it also has the disadvantage that it is difficult to handle subspecies because it cannot be determined by regular expressions). Furthermore, with this method, it is easy to transfer the referrer data of Google Analytics to a Google spreadsheet, mark the spam referrer, and automatically incorporate it into the spam judgment of Google Tag Manager using the API. It seems to be possible.
In the previous referrer spam avoidance method, it was necessary to create a new property, and I think it was difficult to execute. Creating even simpler filters can help you escape the curse of referrer spam.
If you have been stuck in filter hell by setting many filters to escape from the spell of referrer spam, please try this method.