#GTMTips: A simple way to exclude internal traffic from Google Analytics – News Couple
ANALYTICS

#GTMTips: A simple way to exclude internal traffic from Google Analytics


With so many people working from home or remotely in these turbulent times, it’s time to revisit one of my oldest articles and discuss your options for excluding or segmenting internal traffic in Google Analytics.

The traditional method of IP address exclusion is not necessarily the best option anymore, unless all of your employees use a particular VPN to connect to the site.

In this article, we will learn about some of the tools available to you.


X


Simmer . Newsletter

Subscribe to the Simmer newsletter to get the latest news and content from Simo Ahava right in your inbox!

Tip 111: Exclude internal traffic from Google Analytics

In my opinion, the simpler And the most elegant The way to exclude an arbitrary block of users is to use URL query parameter method I will summarize below.

URL query parameter method

The way it works is that all employees, remote controls, and other users whose traffic must be accounted for internal The site must be visited with a specific URL query parameter. With Google Tag Manager, you can use this query parameter and send it as a file The custom component in the user’s domain to Google Analytics.

You can then create a view filter that excludes that particular custom block from the main report views, or you can use segments to limit the number of visits in the reports.

To get started, you’ll need to create a file New URL query variable In the Google Tag Manager.

URL query variable

go to the Variables, scroll down to User-defined variables, and click the new button to create a new variable.

Choose URL as a species.

Puts Component type to me Inquiry, And query key to me internal.

Internal query URL

Variable name with something like URL - Query - internal and save the variable.

Custom dimension

In Google Analytics, go to Supervisor, and click Custom definitions In the middle column (property settings). Choose Custom Dimensions.

click + New custom dimension Creates a new custom dimension.

construction user-Dimensional scale, name it Internal Traffic.

custom dimension

Once created, make a note of a file index number.

Edit your Google Analytics tag

In Google Tag Manager, find a file page width mark, and open it for editing.

If you haven’t done so already, check Activate override settings in this tag.

sought More settings, Then Custom Dimensions, and click + Add custom component To add a new custom dimension.

Designation index From the row to the index number of the custom component you got from Google Analytics, and set Dimension value as a variable you just created.

The custom component in the GA . tag

Save Changes.

Test!

Now you can visit the site. First, visit the page without the query parameter. You should see the Google Analytics tag launch, and the custom dimension should appear where you added the URL variable to undefined. That’s fine – we don’t want to send a value to GA unless it is true.

Custom dimension not specified

then add ?internal=true (or &internal=true If the URL already contains a query string) to the end of the URL, before any possible hash fragment (#hash), and press Enter to reload the page.

This time you will see the Google Analytics tag that selects the string true and send it as the custom dimension value to Google Analytics.

Customized Ingredient at Real Value

That’s it! You are now populating the user scope custom component with the value true For all users who visit the site using the query parameter internal=true.

Create a view filter

You can simply use segments to separate the traffic into internal and the rest, but you’ll probably want to use view filters instead to avoid polluting your view with internal traffic.

This is what the view filter would look like:

Custom Width Filter

When this filter is activated, all sessions from users that have the value true I sent even once to GA from the Google Analytics view.

How to reappear user data

If you want to undo this for any particular user, all they have to do is visit the site with a file internal Query parameter, use it verbatim any other value But true.

So they can visit with internal=false or internal=ratamahatta – Anything goes.

As soon as you send istrue To Google Analytics as a value internal parameter, it will be counted between non-internal visits again.

other options

If you think that using query operators is cumbersome, you can write a simple URL rewriting rule, which redirects visits to like office.domain.com to me www.domain.com/?internal=true. This way users will only need to remember the domain name instead of having to add a URL parameter.

Alternatively, you can suggest users to install Browser Extension which automatically block their visits from certain websites. This is easy to do as well, but it requires a specific browser to use it.

If users Use a VPN When you are in company business hours, you can configure the VPN IP to exclude in Google Analytics, or you can modify the VPN to add an HTTP header (x-internal-traffic or something like that), which your web server can then translate into a file dataLayer.push().

There are many ways to skin a cat, but the key is that there is almost certainly a manual step that all indoor users will need. The query parameter is the set-and-forget method, that’s why I personally prefer it.

summary

This article was a re-introduction of a six-year-old solution of mine, which has never been more so than before. With the outbreak of the COVID-19 pandemic, more and more people are working remotely, which leads to a surprisingly strong problem of how to block this traffic from the main report views in Google Analytics.

The solution to the URL query operator is simple, because optimally users only need to do it Once for each browser. Of course, with Safari’s ITP and the short cap on cookie expiration, it’s actually not that simple. But with tracking blocking, nothing.

Other solutions are listed at the end of the article, but I’d like to hear your feedback – do you have ideas/solutions missing from this article? Please share them in the comments!



Source link

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button