WordPress filters for Google Analytics
If you use Google’s excellant Analytics service to track traffic to your WordPress blog you may have noticed that days were you have been doing a lot of administrative work or writing on your blog that you had large traffic spikes. This is due to Google Analytics recording all your administrative and writing related visits to your site and this can be quite misleading if your trying to improve your traffic.
Fortunately there is a very simple way to configure Google Analytics to prevent administrative pages and post preview pages being recorded as genuine site traffic.
- Login into Google Analytics.
- Click the ‘Analytics Settings’ option in the top left:

- Click the ‘Edit’ option for your blog’s site:

- Click the ‘Edit’ option for the ‘Main Website Profile Information’ section:

- Enter ‘preview=true|wp-admin’ into the ‘Exclude URL Query Parameters:’ textbox and click ‘Save changes’:

Google Analytics will now ignore all visits to WordPress’es administrator pages (which are in the ‘wp-admin’ subfolder on a typical install) and also ignore any page previews (which have ‘preview=true’ in the URL). You can now administrate your site and write posts without worrying about your actions skewing you site’s traffic data!
Hi Daniel,
Thanks for this and I have added the code. You can also create an exclusion in Google Analytics i.e. to exclude your IP range so that it excludes all visits you make.
@maybak It will not correct the past but it will trend out for the future.
Daniel, your filter worked out well. I don’t have this problem anymore.
@Internet Marketing, indeed, I’ve noticed it didn’t correct my past data. Thank you for you answer.










Hi Daniel,
In early July, I’ve changed my WordPress theme. Since then, I’ve noticed “preview=true” and “wp-admin” pages being ranked in my Top pageviews. My stats are thus biased. I’ve followed your advise. Will it only apply to the future traffic on my website or will it “correct” previous statistics ?
@maybak