When you have a WordPress site (or many), you might be inadvertently padding your Google Analytics Pageview data. When you “Preview” a post or a page in a browser, you are adding a pageview to your Google Analytics data. This will give you data that’s not accurate and can prove to be misleading as you make decisions about your site in the future.
The best way to remedy this situation is to create a “Filter” within Google Analytics. To do this you’ll need to go to your Google Analytics setting for your WordPress site.
- Click on “Filters” and then “+ New Filter”
- Select “Create new Filter for Profile”
- Name your filter – I called mine “WordPress Preview”
- For the Filter Type, select “Custom Filter”
- You’re going to want “Exclude” this traffic from your reports
- The Filter Field should be “Request URI”
- For the filter pattern, use the regular expression: “/p=[0-9]+&preview=true”
- Click “Save”
That’s it. Now all traffic that is previewing a post or a page will not get counted in your Google Analytics data.