How to Block Internal Traffic to Your Website from Google Analytics

Estimated Reading Time: 5 minutes

UPDATE 9/13/2013:

Thanks to my brilliant colleague Andy Gibson, there is an update to how this works.  With Google Analytics User Variable deprecated, you will instead need to use custom variables to block internal traffic to your website.  That is our recommended approach.  See below for how to do this on your site code directly, or check out Andy’s blog post to better learn how to do this with Google Tag Manager.

There are several ways to exclude internal traffic to your website from your Google Analytics.  You may beg the question, “why would I want to exclude myself from my own site reports?† Internal traffic (that is traffic from employees and web masters that work with your website) can inflate visitor counts and pageviews to your site, thus giving you false or misleading data.  We are fans of data clarity so we highly recommend distinguishing traffic from internal entities from those visitors that you want your website to speak to, aka your audience.  There are different ways to do this depending on how your company infrastructure is set up, between static or dynamic IP addresses.  You can filter internal traffic out by ISP, IP, by domain or by user variable.  You can segment out internal traffic by using custom variables, user variables, ISP and possibly more!  Both filters and advanced segments can split the traffic from internal sources away from the rest of your traffic, but for the sake of this blog post I will discuss how to block internal traffic that are using dynamic IP addresses with advanced segments.

The first step is setting up a webpage that will install a cookie on all browsers and computers that your internal team may use to access your website.  This cookie will be set by a custom variable you put on your site.  Here’s what you’ll need to do:

    1. Create a new webpage with any content, even no content, because it can be hidden as part of your domain or just a static webpage. Instead of the old way of doing this with the setVar method, you will now want to use the setCustomVar method to set a custom variable on this page. See the code below as an example and insert the Google Analytics tracking code with the slight change onto this new webpage:Custom Variable Internal Traffic Blocking Google Analytics Code
    2. In your Google Analytics account, go to the “Advanced Segment†section and click “+New Custom Segmentâ€.Visitors Overview Google Analytics Advanced Segment

       

    3. Name this custom segment “Include Internal Trafficâ€, then input the following logic:Include-> Custom Variable (Value 01) -> Containing -> Yes

      Include Only Internal Traffic Custom Variable Google Analytics

      NOTE*** This is based off my example, where I used the Custom Variable in slot 1.  Make sure you’re Google Analytics custom variables do not overwrite (if you have multiple CVs saved to the same slot) and you match the advanced segment to the correct slot (this example is ‘Value 01’). 

    4. Create another custom segment and name it “Exclude Internal Trafficâ€, then input the following logic:Exclude -> Custom Variable (Value 01) -> Containing -> Yes

      Exclude Internal Traffic Custom Variable Google Analytics

      Save the segment but again, note that the containing field must match exactly to the code you initially wrote in the _setCustomVar method on the static webpage in step 1 (in this case, “Yes†for Value 01 or custom variable slot 1).

    5. Send everyone that is on your internal team a link to the webpage you created in Step 1 so they can install the cookie on their browser.NOTE: Each team member must go to that webpage on EVERY browser they use, on EVERY computer they use, including mobile devices.  This will ensure ALL internal traffic is tracked appropriately.

    6. Now to test.  Unfortunately, you will need to wait a few days before the segmented data shows up (since the cookie needs to be installed first).  If you wait 1-2 weeks after everyone on your team goes to the page you created in Step 1 on all browsers/computers, and if they visit your website in this time, you can then use the advanced segments and compare the traffic.  Just click the Advanced Segments button to see the advanced segments you created.Visitors Overview Google Analytics Both Advanced Segments
    7. The “Include Internal Traffic†segment shows ONLY internal traffic, so this number will be significantly less than ALL traffic as it is only showing your internal team visits.Internal Visits Advanced Segment Google Analytics
    8. The “Exclude Internal Traffic†advanced segment will show all visits LESS internal visits.  I like this segment the best because it shows the true number of visits outside of the internal team. Exclude Internal Visits Advanced Segment Google Analytics
    9. Showing both segments at once gives you an idea of how much real traffic you have compared to internal traffic.Internal Visits Including and Excluding Advanced Segments Google Analytics
    10. The best part about using advanced segments to track internal traffic on dynamic IP addresses is you are not permanently altering  the incoming traffic, merely manipulating the data view to see different information.  You can activate and deactivate the advanced segments as you choose without losing any data!  You can also share advanced segments to other users on your analytics, even if they are not administrators, by going to your Admin tab, clicking the Advanced Segments under Assets and clicking “shareâ€.Share Advanced Segments Google Analytics

      This is a nifty tool to make sure your digital marketing efforts are attracting your REAL visitors, not just your internal team.



Learn more about our analytics services


Article Written by Amin Shawki

Author

  • Amin Shawki

    Amin is Head of Growth at InfoTrust and comes from humble beginnings as a Social Media Intern. Wearing multiple hats and having had multiple roles, including most notably starting and leading the expansion in Dubai, UAE for InfoTrust, Amin enjoys working with the international team across many different clients and projects to drive growth and new innovations for the company. Never against a chill night playing some Settlers of Catan but always up for an adventure to try new things.

Facebook
Twitter
LinkedIn
Email
Originally Published: July 12, 2012

Subscribe To Our Newsletter

August 7, 2023
Originally published on July 12, 2012

Other Articles You Will Enjoy

Tracking User Behavior with Events in Google Analytics 4: Examples and Use Cases

Tracking User Behavior with Events in Google Analytics 4: Examples and Use Cases

So you’ve created your Google Analytics 4 (GA4) properties, created your data stream(s), and followed all the necessary steps to configure your property. Now…

5-minute read
A Beginner’s Guide to Visualizing Google Analytics 4 Data with Looker Studio

A Beginner’s Guide to Visualizing Google Analytics 4 Data with Looker Studio

In today’s digital marketing world, tracking and analyzing user behavior on your website is crucial for making data-driven decisions. Google Analytics 4 (GA4) is…

5-minute read
Google Tag Best Practices for Google Analytics 4

Google Tag Best Practices for Google Analytics 4

After collaborating with several of my colleagues at InfoTrust including Bryan Lamb, Head of Capabilities, Corey Chapman, Senior Tag Management Engineer, Chinonso Emma-Ebere, Tech…

4-minute read
How to Track User Engagement and Behavior on Your Website Using Google Analytics 4 Custom Metrics

How to Track User Engagement and Behavior on Your Website Using Google Analytics 4 Custom Metrics

Understanding how users engage with your website is crucial for improving user experience and achieving your business goals. Google Analytics 4 (GA4) offers a…

5-minute read
Is It Time to Upgrade? 4 Signs Your Organization Needs Google Analytics 4 360

Is It Time to Upgrade? 4 Signs Your Organization Needs Google Analytics 4 360

As VP of Partnerships at InfoTrust, I’ve had the opportunity to talk with hundreds of decision-makers about their interest in upgrading to Google Analytics…

4-minute read
Understanding Data Migration and Retroactivity in Google Analytics 4: Your Questions Answered

Understanding Data Migration and Retroactivity in Google Analytics 4: Your Questions Answered

As we navigate the transition from Universal Analytics (UA) to Google Analytics 4 (GA4), questions about data migration, retroactivity, annotations, filters, and audience segments…

3-minute read
Unveiling the Mysteries of Google Tag: 10 Things You Need to Know

Unveiling the Mysteries of Google Tag: 10 Things You Need to Know

If you’ve recently stepped into the realm of Google Analytics 4 (GA4) and are scratching your head about the new kid on the block—Google…

4-minute read
Advanced Analysis Techniques in Google Analytics 4: How to Use AI-Powered Insights and Predictive Analytics for Effective Marketing

Advanced Analysis Techniques in Google Analytics 4: How to Use AI-Powered Insights and Predictive Analytics for Effective Marketing

AI-powered insights and predictive analytics are revolutionary tools reshaping the modern marketing landscape. These advanced analytics techniques, particularly prominent in Google Analytics 4 (GA4),…

8-minute read
A Deep Dive into Google Analytics 4: What’s New and Improved

A Deep Dive into Google Analytics 4: What’s New and Improved

‘Tis the season for some new and improved Google Analytics 4 (GA4) features! Over the course of the next year, GA4 will be introducing…

3-minute read

Get Your Assessment

Thank you! We will be in touch with your results soon.
{{ field.placeholder }}
{{ option.name }}

Talk To Us

Talk To Us

Receive Book Updates

Fill out this form to receive email announcements about Crawl, Walk, Run: Advancing Analytics Maturity with Google Marketing Platform. This includes pre-sale dates, official publishing dates, and more.

Search InfoTrust

Leave Us A Review

Leave a review and let us know how we’re doing. Only actual clients, please.