Don’t Count Me!: Google Analytics and WordPress

As a new WordPress blogger, going back and forth editing pages and making sure they look terrific — I’m generating most of my own Google Analytics page views.  When I get a real page view, I want to know it!  Fortunately, if you already have Google Analytics installed, it’s very simple to accomplish in WordPress.

Jeb Recommends
[amazon-product image=”https://jebstone.com/images/41K0nbpVIqL._SL160_.jpg” type=”image”]0470529393[/amazon-product]

EpikOne has a great post on how to exclude yourself from Google Analytics, and with a very slight modification you can create an admin page in WordPress that provides a one-click solution no matter where you’re editing from.

Step 1. Create a new page

Create a new page.  I named mine “noGA” but you can call it whatever you like.  Set Visibility to “Private.” Paste the following code into the HTML editor window and then publish the post.  This will create a page (e.g., jebstone.com/noGA) with a single link.  When you click the link, this will set a value in the Google Analytics cookie so that it can know not to track you.

<a onclick=”pageTracker._setVar(‘noGA’);alert(‘Custom segment has been set.  Time to create a filter.’)”>Click this Link</a>

A visual example of how to do this:

Screenshot illustrating how to set up your Google Analytics Exclude Me page in WordPress
Screenshot illustrating how to set up your Google Analytics Exclude Me page in WordPress

Step 2. Create an Exclude Filter in your Google Analytics account

Log in to Google Analytics.  In the Filter Manager, create a new user-defined filter as follows:

Creating a user-defined filter to prevent Google Analytics from tracking your activity
Creating a user-defined filter to prevent Google Analytics from tracking your activity

Step 3. Navigate to your new page and click the link

Congratulations! You are no longer tracking your own activity in Google Analytics! Remember, cookies are browser- and machine- specific, so for every browser and machine you use, you’ll need to navigate to this page and click the link.

2 thoughts on “Don’t Count Me!: Google Analytics and WordPress”

Leave a Reply

Your email address will not be published. Required fields are marked *