In the past, it was common to block internal traffic with the IP address used by the company. But now most people access the website with a smartphone or a laptop from outside the company. Only using IP address, there is an issue that internal traffic from outside the company cannot be blocked.
There are several ways to block these traffic, but this article introduces a method using Google Tag Manager.
This article assumes that you have used Google Tag Manager and Google Analytics, and does not mention the introduction of Google Tag Manager and Google Analytics, and how to set it up.
First of all, please see how the method works.
*You can check how your container on Google Tag Manager works with Preview Function like this video.
It is implemented by using URL parameter, Custom Dimension, and Filter on Google Analytics and Google Tag Manager.
There are the following eight steps to block internal traffic like the above video.
Internal traffic is judged/blocked based on whether the URL has the parameter or not. In the following paragraphs, I will introduce details of what you need to do in order to block internal traffic with Google Tag Manager.
In this step, create a User-Defined Variable on Google Tag Manager.
First, jump to the container using for your website which you want to block internal traffic.
Then create a User-Defined Variable “URL_filter”. You can use any name for this variable.
Next, add a Custom Dimension to the Tag which you set Universal Analytics on Google Tag Manager. Open the Tag and click the Tag type. Then open Custom Dimensions in More Settings.
There is a button “+ ADD CUSTOM DIMENSION”. Once press it, two boxes, Index and Dimension Value appear so enter “1” to Index and choose the variable created in the previous step as Dimension Value. Finally press “SAVE” button in the upper right.
The settings on Google Tag Manager are over.
From here, set up Google Analytics. Open Admin Window of the property you want to set up.
Then, add a Custom Dimension “URL_filter” like the video below. You can you any name to this Custom Dimension.
By setting up so far, you can get the user who accessed the URL with the parameter. The next step is filtering these users.
So open the Admin Window as in the previous step, and create a filter to block users who accessed the URL with the parameter.
Click Filters in the column “View” on Admin Window, then “+ ADD FILTER” button appears. So press it. Next, enter your preferred name to Filter Name.
Once you switch Filter Type to Custom, “Filter Field” and its drop-down list appear. Choose the Custom Dimension you created in the previous step, in my case “URL_filter” from the drop-down list.
Enter “true”, you can use any word, to Filter Pattern, then press “Save” button.
Before submitting the Google Tag Manager container, we should validate whether it works properly. Once you press “PREVIEW” button on Google Tag Manager and open the website, an iframe appears at the bottom of the page.
When you hit the URL with the parameter, “true” or the word you set must have appeared as the value of the dimension. If you find it, it’s working properly.
In the case you can”t find the value or Custom Dimensions, there may be some mistakes like you set wrong Valuable/Trigger/Custom Dimension.
Please confirm that it was set correctly according to the previous steps.
Once you find the container works properly, go ahead to submit the container.
In step six, you have completed the settings on Google Tag Manager and Google Analytics but there is one more thing you need to do in order to block the internal traffic in real.
This method identifies users who access the URL with the parameter. So you need to ask all in-house people to access the URL with the parameter on each device and browser.
If one person accesses your website with Chrome on a laptop, and Chrome and Safari on a smartphone, the number of users is going to be three. Because users are identified with Cookie. That’s why all in-house people have to access the URL with the parameter on each device and browser.
You can see that Internal Traffic is blocked in Google Analytics from the next day you set like on the image below.
Let me explain a bit about what is going on. In this image, a segment is created that filters users who have “true” stored in custom dimension URL_filter. The number of users which appears on the right side of the image is 0. This means that the user who accessed the URL with the parameter “internal=true” is properly blocked.
|Can block the internal traffic from outsite the company||Have to access the URL with parameter on each device and browser|
|More accurate traffic data can be obtained compared to blocking with only IP address||External traffic is also blocked when accessing the URL with the parameter|
When the parameter setting leaks out, external traffic is also blocked when accessing the URL with the parameter. There are several ideas to prevent this problem. First, don’t use the same parameter I wrote in this article. Second, keep the parameter secret.
Don’t set a filter on Google Analytics and block these traffic when you analyze the traffic. It is also another idea.
There is such disadvantage in the table above, but in this era where traffic from outside the company has increased, blocking internal traffic by this method using Google Tag Manager has the advantage outweigh these disadvantages.
1. You can block internal traffic from outside the company with Google Tag Manager.
2. More accurate traffic data can be obtained with this method
3. All in-house people have to access the URL with the parameter on each device and browser
Work with Cambodian Entreprener
Work with Visionary Entreprener