Filter Wordpress Admin Traffic in Google Analytics

Ever notice a bump on you in wordpress traffic after making modifications to your site. It happens to everyone when making large changes to your site. You will need to already have created and configured your Google Analytics. In this post we will discuss how to filter Wordpress admin traffic in Google Analytics. The most preferred way is by setting a cookie. You can go ahead and skip to the bottom if that’s all you need.

Google analytics allows you to filter traffic in a few ways.

  • IP address
  • By url
  • Excluding traffic by Cookie content.

Finding the Filters

First find the filters page after clicking the Admin tab at the top after selecting your website from the home page. Then under the VIEW tab on the right find the filters button.

google analytics admin page
Google Analytics admin page

Filter by IP Address

A quick google search of what’s my IP address will tell you your current address. Usually your IP address is only static on business level internet providers. Mine hasn’t changed in a long time with my ISP so for good measure I add it anyway.

Google Analytics filter by IP address
Google Analytics filter by IP address

Next up we will set up filters based on portions or entire URL’s we specifically want to ignore. This includes any URL’s with wp-admin, or preview=true.

Filtering by URL

Let’s go ahead and add the Post Preview Filter. Verify the filter to see which pages will be filtered.

Google Analytics Filter Wordpress Preview Posts
Google Analytics Filter Wordpress Preview Posts

Then we will go ahead and add the admin page for good measure.

Google Analytics filter Wordpress Admin
Google Analytics filter Wordpress Admin

Filter by cookie

Finally the preferred way is to create a simple html document that you can access on all your devices that will save a cookie with a variable that we can then use to filter out all your devices. Create filter-website-name-traffic.html, edit your Google account number where UA-12345678–9 is, and then upload it to your wordpress directory. Note the copy button on the toolbar when you mouse over

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title>Excluding Google Analytics traffic by Cookie</title>
<meta name="robots" content="noindex"/>
<!-- Google Analytics Code -->
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-12345678-9']);
_gaq.push(['_trackPageview']);
_gaq.push(['_trackPageLoadTime']);
(function () {
var ga = document.createElement('script');
ga.type = 'text/javascript';
ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(ga, s);
})();
</script>
<!-- Google Analytics Code -->
</head>
<body onLoad="javascript:pageTracker._setVar('filter_traffic');">
<div>
<h1>Excluding traffic by Cookie Content</h1>
<p>This page will set a cookie in your browser that will help Google Analytics filter the traffic that comes from
your
computer when using this browser.</p>
<p>Once you have this setup, don't forget to set a filter in Google Analytics.</p>
<p>You will need to visit this page only once.</p>
<p>If you clear your browser cookies, reinstall the browser or operating system, make sure that you revisit this
page,
so the cookie will be set again.</p>
</div>
</body>
</html>
Filter traffic by cookie
Filter traffic by cookie

Add the filter. Then on each of your devices (desktop, laptop, phone, tablet etc) browse your website.com/filter-traffic.html and it will automcatially save the cookie for future reference.

Check out more amazing content on our optimizing Wordpress page.

Or subscribe to our newsletter for more great posts!

Email address:

We love comments! Leave questions or comments below.


Originally published at J-Tronics.co.