How to Remove Internal WordPress Traffic from Google Analytics

How to remove internal WordPress traffic from Google Analytics
How to remove internal WordPress traffic from Google Analytics

When running an SEO Campaign, it's important to have clean data as that's what is used to guide your decisions.

Be default, Google Analytics tracks all traffic to your website., including your internal hits.

You need to filter out your internal traffic to get accurate traffic numbers from your organic SEO campaign.

All of your logged in WordPress users are getting tracked by default.

These visits will over-inflate your analytics reports and give you inaccurate data.

I’m going to show you how to use Google Tag Manager to filter out these logged in WordPress users so their traffic stops showing up in your Google Analytics reports.

So without further ado lets gets started!

Pre-requisites:

  1. This entire guide takes place inside Google Tag Manager.
  2. You’ll need an account with Google Analytics connected to follow this tutorial.
  3. If you do not currently have a Google Tag Manager account already, please watch this tutorial first:
  4. How to Get Started with Google Tag Manager - LINK TO MORE CONTENT
  5. If you do not have Google Analytics connected to your Google Tag Manager account you’ll need this tutorial:
  6. How to Connect Google Analytics to Google Tag Manager - LINK TO MORE CONTENT

Login to Google Tag Manager and Create a New Variable

  1. Go to Google Tag Manager.
  2. Click on “Variables”.
  3. Scroll down to “User-Defined Variables and click “New”.
  4. Click in box that appears on screen and choose “DOM Element” from the list on the right.
  5. From the “Selection Method” dropdown choose “CSS Selector”.
  6. In the “Element Selector” field type “body.logged-in”.
  7. Save the variable and name it something like “WordPress Logged In”.

Create a Trigger That Will Get Our New Variable to Fire

  1. Click on “Triggers”.
  2. Click “New”.
  3. Choose “DOM Ready”.
  4. Under “This trigger fires on” choose “Some DOM Ready Events”.
  5. Under “Fire this trigger when an Event occurs and all conditions are true” choose the variable you created above (ours was named “WordPress Logged In”).
  6. Change dropdown to “equals” and in the next field type “null”.
  7. Click “Save” and name the trigger anything you want.

Attaching our Trigger to our Google Analytics Tag

  1. Click on “Tags”.
  2. Click on your Google Analytics Tag (ours is called “GA”).
  3. Under “Triggering” click the pencil icon to edit.
  4. Click the “+” icon to add a new Trigger.
  5. Choose the trigger you created in the last step our (ours is called “Site Visitor”).
  6. Make sure that the Variable you created in the steps above is showing year under the “This trigger fires on” section.
  7. Add this Trigger and delete the “All Pages - Page View” Trigger by clicking the “-” icon.

Saving and Previewing Our Workspace Container to Ensure It’s Working Correctly

  1. Ensure Publish and Create Version is highlighted.
  2. Add a name for your changes.
  3. Add a description detailing what you did for future reference.
  4. Click save.
  5. Click Preview to preview your changes.
  6. Go to your website where this Tag is active.
  7. The GTM preview box will show up at the bottom of your browser window.
  8. Look in this box and under the “Tags Summary” screen you want to ensure that:
  9. When Logged into WordPress - “Tags Fired on this Page” is None & “Tags Not Fired on This Page” is showing your Tag.
  10. When Logged out of WordPress - “Tags Fired on this Page” shows your Google Analytics Tag (ours we named GA) and “Tags Not Fired on this Page” is None.
  11. If both tests above pass, then you’ve correctly installed your Google Tag.
  12. If they fail, go back through this lesson and follow it again step-by-step to ensure you haven’t missed anything.

Successfully Filtering out Logged in WordPress Users

Now that you’ve completed this tutorial your Google Tag Manager (GTM)  should be successfully filtering out logged in WordPress users from your Google Analytics reports.

Congratulations!

Avatar for Mark Phillips

Mark Phillips

Mark is a digital marketing specialist from Edmonton, Alberta. He's been working in the digital marketing industry since 2008 for various agencies and clients. He specializes in search engine optimization (SEO) and WordPress website design services. Connect on LinkedIn.