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.
So without further ado lets gets started!
Remove Internal WordPress Traffic from Google Analytics with This Video Tutorial
- This entire guide takes place inside Google Tag Manager.
- You’ll need a Google Tag Manager account with Google Analytics connected to follow this tutorial.
Login to Google Tag Manager and Create a New Variable
- Go to Google Tag Manager.
- Click on “Variables”.
- Scroll down to “User-Defined Variables and click “New”.
- Click in box that appears on screen and choose “DOM Element” from the list on the right.
- From the “Selection Method” dropdown choose “CSS Selector”.
- In the “Element Selector” field type “body.logged-in”.
- Save the variable and name it something like “WordPress Logged In”.
Create a Trigger That Will Get Our New Variable to Fire
- Click on “Triggers”.
- Click “New”.
- Choose “DOM Ready”.
- Under “This trigger fires on” choose “Some DOM Ready Events”.
- 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”).
- Change dropdown to “equals” and in the next field type “null”.
- Click “Save” and name the trigger anything you want.
Attaching our Trigger to our Google Analytics Tag
- Click on “Tags”.
- Click on your Google Analytics Tag (ours is called “GA”).
- Under “Triggering” click the pencil icon to edit.
- Click the “+” icon to add a new Trigger.
- Choose the trigger you created in the last step our (ours is called “Site Visitor”).
- Make sure that the Variable you created in the steps above is showing year under the “This trigger fires on” section.
- 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
- Ensure Publish and Create Version is highlighted.
- Add a name for your changes.
- Add a description detailing what you did for future reference.
- Click save.
- Click Preview to preview your changes.
- Go to your website where this Tag is active.
- The GTM preview box will show up at the bottom of your browser window.
- Look in this box and under the “Tags Summary” screen you want to ensure that:
- When Logged into WordPress – “Tags Fired on this Page” is None & “Tags Not Fired on This Page” is showing your Tag.
- 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.
- If both tests above pass, then you’ve correctly installed your Google Tag.
- 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.