{"id":4665,"date":"2020-09-03T11:19:14","date_gmt":"2020-09-03T08:19:14","guid":{"rendered":"https:\/\/trackingchef.com\/?p=4665"},"modified":"2020-12-14T15:12:40","modified_gmt":"2020-12-14T12:12:40","slug":"how-to-exclude-wfh-traffic-in-google-analytics","status":"publish","type":"post","link":"https:\/\/trackingchef.com\/google-analytics\/how-to-exclude-wfh-traffic-in-google-analytics\/","title":{"rendered":"How to exclude WFH traffic in Google Analytics (Expert roundup)"},"content":{"rendered":"\n
COVID-19 has driven the majority of office workers to a new reality of work from home (WFH). Besides the usual challenges this brings (e.g. Zoom meetings with kids screaming in the background), this also poses a challenge for Web Analysts.<\/p>\n\n\n\n In the good ol’ days, pre-COVID, we could simply exclude the office IP<\/a> or even an entire IP range to remove all internal traffic from reports. But in this new reality, with all our workforce split across countless everchanging IPs, a different solution is required.<\/p>\n\n\n\n In this post, I’ve gathered some of the top Google Analytics experts to share their ideas for dealing with such traffic.<\/p>\n\n\n\n When considering such an exclusion strategy, we need to consider two things:<\/p>\n\n\n\n In absence of an IP or even an IP range, another technique is required to identify the users. In this post I’ll suggest several ways to proactively flag these users.<\/p>\n\n\n\n Do we block them at the source (i.e. stop GA from firing for them) or filter them out in GA (after highlighting them in the browser).<\/p>\n\n\n\n I generally find it easier to block at the source. The flip side is that for testing purposes (e.g. verifying that a form submission is tracked) you’ll need to disable the blocking mechanism. In this post I have examples of both techniques.<\/p>\n\n\n\n This solution was suggested by Thomas Bosilevac<\/a> from MashMetrics<\/a>.<\/p>\n\n\n\n “Send your internal users a link to a URL with a parameter that will mark them as internal traffic, for example mysite.com?exclude=true<\/em>.”<\/p><\/blockquote>\n\n\n\n Using Google Tag Manager, you can easily create a script (using a Custom HTML tag) that captures this parameter and saves it in a browser cookie.<\/p>\n\n\n\n First check if the cookie value exists, by creating a variable that captures the URL Parameter of the name “exclude”<\/p>\n\n\n\n Then use variable to check its value and sets the cookie value accordingly.<\/p>\n\n\n\n Finally, create a variable to capture the value of the cookie.<\/p>\n\n\n\n This cookie value can then be used as an Exception Rule for your tags in GTM.<\/p>\n\n\n\n Create a new trigger for All Pages that exclude the<\/p>\n\n\n\n Add this trigger as an Exception for you GA tag.<\/p>\n\n\n\n This solution was suggested by Erez Louzon<\/a> from ThinkUser<\/a>.<\/p>\n\n\n\n “For more technical teams, I suggest creating a redirect URL (on your main domain). A user navigating to this URL will be redirected to the homepage using a Javascript redirect, while a the browser storage is set with the exclusion parameter.”<\/p><\/blockquote>\n\n\n\n Similar to Vanity URL solution, this value can be picked up in GTM and used as an Exception Rule.<\/p>\n\n\n\n The general outline of such a page will include this code:<\/p>\n\n\n\n The function sets browser cookie item called “exclude” to true. This item will also be available if the user returns again from the same browser.<\/p>\n\n\n\n It then redirects the user to a new page. You can replace the target URL with your own site.<\/p>\n\n\n\n To capture this in GTM, simply create a variable that captures the values of the cookie “exclude” as described above.<\/p>\n\n\n\n This solution was suggested by Or Blan<\/a> from Ynet<\/a>.<\/p>\n\n\n\n I prefer to flag the internal traffic using a Custom Dimension. This way I can exclude them from my work Views in GA and still view them in my backup view for testing purposes.<\/p><\/blockquote>\n\n\n\n To set up this you will need to first, create a Custom Dimension in Google Analytics with a relevant name, for example “Internal traffic”. <\/p>\n\n\n\n Next, grab the dimension index, e.g. 01, and add it to the Google Analytics Settings variable in GTM (under More Settings -> Custom Dimensions). The Dimension Value should be set to the Exclude cookie<\/em> as described above.<\/p>\n\n\n\n Once this is set up in GTM, you can return to GA to create the filter.<\/p>\n\n\n\n Set the Filter Type to “Custom” and select the Custom Dimension you created. The filter pattern should be set to “true” (the value sent in the Custom Dimension).<\/p>\n\n\n\n A good tip I’ve received from my friend Shuki Mann<\/a> of LixFix<\/a>:<\/p>\n\n\n\n Excluding only Pageviews isn’t always enough, as many sites also track other interactions such as scroll depthor video views. In such a case excluding all hits is the key to a clean account.<\/p><\/blockquote>\n\n\n\n Shuki also shared his recipe for success:<\/p>\n\n\n\n Create a Lookup Table variable that takes in the Exclusion Cookie value. If it’s set to true<\/em>, fire a different Analytics UA (e.g. your staging environment’s UA), else default to your regular Analytics UA.<\/p>\n\n\n\n Use this variable in your GA Events and Pageview tags.<\/p>\n\n\n\n This solution was suggested by Daniel Saada<\/a> from Blocket<\/a>.<\/p>\n\n\n\n “A simpler solution I’ve found for large scale teams, it to simply encourage them to install the GA Opt-out extension on their browser. In some companies, the IT can even enforce that these extensions are installed”.<\/p><\/blockquote>\n\n\n\n This browser extension, offered by Google, completely block any Google product on the site. This can block a GA script installed directly on the site or via GTM.<\/p>\n\n\n\nConceptual framework<\/h2>\n\n\n\n
How can we identify only the internal traffic?<\/h3>\n\n\n\n
What is the exclusion technique?<\/h3>\n\n\n\n
Vanity URL<\/h2>\n\n\n\n
<script>\n if ({{Exclude parameter}} == true) {\n document.cookie = \"exclude=true\";\n }\n<\/script><\/code><\/pre>\n\n\n\n
Redirect URL<\/h2>\n\n\n\n
<!DOCTYPE html>\n<html>\n<head>\n<title>Internal Traffic Exclusion<\/title>\n<\/head>\n<body>\n<script>\nfunction redirect() {\n document.cookie = \"exclude=true\";\n window.location.replace(\"https:\/\/www.example.com\")\n}\nredirect()\n<\/script>\n<\/body>\n<\/html> <\/code><\/pre>\n\n\n\n
Custom Dimension<\/h2>\n\n\n\n
Update: Excluding all hits<\/h2>\n\n\n\n
Google Analytics Opt-out Add-on<\/h2>\n\n\n\n