Exclude filter in analytics for WordPress post/page previews

Posted by on January 29, 2009 in Analytics

I’ve never had to really create an exclude filter within Google analytics before, never had the need to exclude pages/queries from sites i’ve worked on. However i always need to preview my posts, allows me the opportunity to take another scan over for basic errors and to tweak images (perfectionist at heart).

I’ve hard coded my tracking script into the footer of my wordpress theme, so previewing posts is always tracked within the analytics. No point in creating a custom exclude filter for my home and office ADSL line, as the IP address always changes as well. So the other solution would be just to exclude all “preview=true” URI’s from being tracked, to help having to see my previews in my top content pages breakdown in analytics.

It’s an extremely easy task to do. Simply sign in to your Google Analytics account and edit your blog analytics profile and select the option to “add filter“. You will need to use the custom filter option as seen below:

Add Filter - Select Custom Filter

Once you’re done, you need to select the type of filter you are wanting to create, we are looking to create an exclude filter, so make sure you have the “exclude” option checked. Now you will need to change the “filter field“, which defaults to “visitor geographical domain“, to “Request URI” towards the top of the dropdown (dropup? :) ). URI meaning everything after the domain name, very different to URL.

Custom Filter Details - Exclude Option and Request URI

Next, you’ll need to add your pattern. As this works in a similar manner to the head match option when creating goals in analytics, you will only need to add the common “pattern” that will appear in URI’s that you do not wish to track. Simply add your “preview=true” for the filter pattern, don’t forget to name your custom filter, then save. You are all done.

Adding your filter pattern to your exclude filter

And you’re done! Remember this will only affect any new data tracked going forward and does take some time before you will see updated data within your analytics profile. As a side note, be very careful that the “preview=true” function is not used somewhere else within wordpress legitimately, as you may very well want to track that data.

Sometimes it’s best to tweak and customise yourself, than having to really on plugins to easily solve a need/problem. Hope this little tid bit of info may help some of you.

3 Comments on Exclude filter in analytics for WordPress post/page previews

By Marc Grabanski on March 19, 2009 at 10:45 pm

Thank you! This was just what I needed to clean up my Google Analytics account.

By Adam Fullerton on January 12, 2010 at 5:01 pm

Great post. I’ve been meaning to do this for a while and you laid it out really well, screen shots are always a good idea! Thanks

By Brett Pringle on January 12, 2010 at 5:05 pm

Great to hear Adam! Nothing beats a nice clean top content list in analytics :)

Comment on Exclude filter in analytics for WordPress post/page previews

Previous Post

Next Post