How To Exclude WordPress Preview Traffic in Google Analytics

In the early days of my website, I was going through my website’s Google Analytics Report & I see that Google Analytics tracks WordPress Internal Activities as well.

Meaning, It was tracking the pages I previewed while editing my blog, which was quite a turn off.

The pure purpose of Google Analytics is to help us analyse the characteristics of our consumers to create the best possible user-experience. But in this case, I myself was inflating my website’s data that is not at all helpful in analyzing & deriving conclusions.

Finally I fixed it & now let’s jump into How to exclude WordPress Preview Traffic in Google Analytics.

exclude wordpress preview traffic from google analytics

Table of Content

1. Introduction to WordPress Preview Traffic
2. Google Analytics Filter – Exclude WordPress Preview Traffic in Google Analytics Filter
3. Google Analytics IP Filter – Exclude Internal Traffic in Google Analytics

Introduction to WordPress Preview Traffic

This is what self tracking looks like. Tracking your internal activity in Google Analytics looks like this: “/p=1250&preview=true“. This simply means that I previewed the page whose page ID is “1250“.

Now, there are two ways you can fix this & the good news is all the ways are super easy If you follow this article step-by-step. Choose the suitable one as per your convenience & comment below what did you pick?

wordpress preview traffic from google analytics

Exclude WordPress Preview Traffic In Google Analytics Using Filter

Step 1: Navigate to Admin Section in Google Analytics

In Google Analytics, find the Gear Icon in the left bottom to enter into Admin Section.

Step 2: Select the View & click on Filters

Once you enter the admin section, find the “View” column in the extreme right. Select the View you want to edit & click on “Filter”. I would suggest you keep an Unfiltered View that collects all data irrespective of its nature.

Step 3: Click on the Bold Red “Add Filter” Button

To add the filter, click on “Add Filter” Button

Step 4: Check the Circle Next to “Create new Filter” & Give Filter a name

Now, you want to start by creating a new filter. After that go ahead and assign a name to your filter.

Step 5: Select “Exclude” Filter Type

Since this is not a predefined Filter, Switch to “Custom“.

Right below this, you’ll find filter types such as Exclude, Include, and so on. Check the “Exclude” one.

Choose “Request URI” from the Dropdown below Filter Field, and type “/?(preview=true|action=edit)” in the Filter Pattern.

You might ask, what does this filter pattern mean? Here you go!
Your Website’s URL looks like “YourWebsite.com/?p=1111&preview=true” in case of previewing draft posts & “YourWebsite.com/wp-admin/post.php?post=1114&action=edit” in case of editing a draft post.

Now the point of “Request URI” in the Filter Field is to tell Google Analytics that we are referring to a piece of string of your Website’s URL.

While the pattern “/?(preview=true|action=edit)” means If my URL contains “preview=true” or “action=edit”, exclude that traffic from data.
You can learn more about Regular Expression here

Step 6: Verify your Filter

Click on “Verify this filter“. It’ll show you before & after filter picture of how your data looks like after applying this filter.

Step 7: Click on Save

At last click on Blue “Save” Button & your filter is in place

Note: Data collected onwards is modified as per the applied filter. But note that this does not modify your previously collected data.

IP Address Filter to Exclude Internal Traffic in Google Analytics

Another way to exclude WordPress preview traffic in Google Analytics is by eliminating all your visits to your website by adding the IP Address Filter.

This is certainly the easiest way to exclude your actual visits to your website and not just the preview traffic. But mind that since this exclusion is regulated by IP Address, visits of users who use the same internet connection will also not be recorded because they are the same IP Address holder.

Let’s get started 😉

Step 1: Navigate to Admin Section in Google Analytics

Step 1 to exclude yourself from google analytics

In Google Analytics, find the Gear Icon in the left bottom to enter into Admin Section.

Step 2: Select the View & click on Filters

step 2 to exclude yourself from google analytics

Once you enter the admin section, find the “View” column in the extreme right. Select the View you want to edit & click on “Filter”. I would suggest you keep an Unfiltered View that collects all data irrespective of its nature.

If you want to apply this filter to all the views in a particular account, all you need to do is select “All Filters” under the “Account” Column in the extreme left.

Step 3: Click on the Bold Red “Add Filter” Button

step 3 to exclude yourself from google analytics

To add the filter, click on “Add Filter” Button

Step 4: Check the Circle Next to “Create new Filter” & Give Filter a name

step 4 to exclude yourself from google analytics

Now, you want to start by creating a new filter. After that go ahead and assign a name to your filter.

Step 5: Search on Google “What is my IP Address”

step 5 to exclude yourself from google analytics

Go to Google, search “What is my IP Address” and copy it.

Note: Ask your internet provider or IT team to know the kind of IP Address you’ve. In case of a range of IP Addresses, jump to step 7. It is possible that you do not have a Static IP Address, meaning your IP Address changes from time to time. In that case, jump to Step 8

Step 6: Step for Static IP Address

step 6 exclude yourself from google analytics

If static IP address does change from time to time. If you’re operating from a birck-&-mortar location with a static IP address, follow the steps ahead:

Under the “Predefined” section, select “Exclude” from the first drop-down.

Select “traffic from the IP address” from the second drop-down as shown int he fig. and lastly select “that are equal to

Finally add your IP address in the next field & click on Save in the end.

Step 7: Step for a Range of IP Addresses.

step 7 to exclude yourself from google analytics

A range of IP Addresses means you have more than one IP address, for example, 123.9.16.73 through 123.9.16.78. To add a range of IP Addresses, follow the step along:

Switch to “Custom” and select “IP Address” under the Filter Field.

Add regex “123\.9\.16\.7[3-8]” in the next field. If you know the range of your IP Addresses, create regex here.

Step 8: Step for Dynamic IP Address

step 8 to exclude yourself from google analytics

A Dynamic IP Address is an address that changes from time to time.

Under the “Predefined” section, select “Exclude” from the first drop-down.

Select “traffic from the IP address” from the second drop-down as shown int he fig. and lastly select “that begin with

In my case, I’ve noticed that the last piece of my IP address changes so I resort to this. Add the initials of your IP Address, for example, 123.9.16 & then click on “Save

You’re all caught up! Go on and fire in the comment section which option fits for you. Do you consider WordPress Plugins over fixing things manually?

See you in the Comments ❤

Leave a Message

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