How to Filter WordPress Preview Traffic in Google Analytics

For any website, you want to install a Google Analytics script to track in depth details of your traffic. It’s a powerful and free tool for you to gather insight into where your traffic is coming from, which pages are viewed the most,  highest quality traffic channels, the time your site is most active, and many more valuable data points.

If you’re tracking your own WordPress page views in Google Analytics, you’re going to have problems data integrity – especially for websites that only have a few hundred visitors per month. Having admin traffic being tracked will skew your metrics and give you a false impression of the amount of traffic visiting your website. To fix this problem we only need to create a a few filters in Google Analytics.

  • WordPress Post Preview Pages
  • WordPress Admin Pages
  • Home IP Address

Create a New Filter View

Before creating any filters in Google Analytics, it’s a best to create a new reporting View. A new property View provides you with unfiltered access to all data collected by the Tracking ID and will ensure that if anything goes wrong, you have a Master View with all the data.

  1. Sign in to your Google Analytics account associated with your website and click on the Admin gear icon at the bottom-left of the page
  2. On the third column, click the blue button to + Create View
  3. Keep the data view for Website Insert a new name for this View (ie. “Filtered View”), modify the time zone if needed
  4. Click Create View and you now have a new view created

Custom Filters for WordPress

With your new Filtered View created, make sure you have the view selected from the drop down before creating a custom filter. You’ll want to create two custom filters here: (1) post preview pages, (2) wp-admin page views.

google analytics filter wordpress preview page
google analytics add filter to view
  1. Click Filters in the View column and then the red +Add Filter button at the top
  2. Leave the Choose a method to apply filter to view as Create a new Filter
  3. Insert a Filter Name (ie. “WordPress Post Preview, WordPress Admin”)
  4. For Filter Type, select Custom
  5. Keep Exclude selected and use the filter field drop down to select Request URI
  6. In the Filter Pattern field, insert preview=true
  7. Click Save and and then repeat with the Filter Pattern field of wp-admin and then you’re done!

Predefined IP Address Filter

By Google searching “what is my ip address?” you’ll find out your unique IP Address for you to add into Google Analytics to ensure no traffic will be included in your analytics view. If you have other groups or individuals helping you with your website, please remember to also filter their IP Address as well by rinse and repeat the steps below.

filter ip address in google analytics
  1. Click Filters in the View column and then the red +Add Filter button at the top
  2. Leave the Choose a method to apply filter to view as Create a new Filter
  3. Insert a Filter Name (ie. “(Name) (Location Type)”)
  4. For Filter Type, select Predefined
  5. Keep Exclude and traffic from IP Address, and select that are equal to from the last drop down.
  6. In the IP Address field, insert your unique IP Address
  7. Click Save and you’re done!

Filtering Complete

Your WordPress website is now filtering any admin page views so you can ensure data integrity and evaluate the traffic you gathered to make data driven decisions.

4 thoughts on “How to Filter WordPress Preview Traffic in Google Analytics”

  1. This is exactly what I needed. My data has been corrupted thanks to my ignorance and not knowing how to FILTER urls with my page previews. I have since deleted my old and ugly data, created a new account, and added this filter. Thank you!

  2. Hey.

    Thank you this wonderful tutorial. But I want to ask one thing When I apply the filter view all the previous data of my Google analytics was gone. So I just want to know that is this normal and What about the tracking code do we need to copy the and paste the tracking code again.

    Thank You.

    • Hi Chetan,

      I’m glad to hear that you like the tutorial. There are no changes made to the tracking code when adding filters, so don’t worry about having to copy and paste it again.



Leave a Comment