If you run a blog or website on WordPress, you probably use Google Analytics to monitor your traffic. On new sites, which are still starting to gain traffic, it is very easy to mess up data collection with "fake" accesses when accessing your admin panel (the famous /wp-admin) and when writing and previewing your pages and articles ( preview=true). If you, like me, like to preview and see how your articles will fit and behave with your theme, we need to filter those hits to generate clean, real data for further analysis.
Filtering the preview pages
Before creating any filter, we must create a new one. visualization on the property. This backs up the data to create and test filters; If something goes wrong and we mess up your data, we still have the raw and original property data. To create a new view:
- Get in on Google Analytics and click on Administrator .
- Check that the correct account and property are selected in the top left drop-down.
- in the tab of visit click in create visit . From a descriptive name such as " Filter test ".
Once created, return to the Admin page and verify the Visit newly created is selected. Now let's create two filters to remove the preview and wp-admin pages:
- click in Filters in the tab of Visit and click the button +Add filter .
- Put a meaningful name like " Delete Preview Pages ".
- In Filter Type select Customized .
- Select option Delete .
- In filter field select request URI .
- In filter pattern type it, preview=true.
(This text is present on all preview pages, including the public previews , if enabled).
- click in To save .
Filtering Admin Dashboard Pages (/wp-admin)
To filter the admin panel pages, we will follow almost all the same steps as above except defining the filter.
- Create a new filter by clicking the button +Add filter (In the same view property).
- Put a meaningful name like "Delete Administrative Pages".
- In Filter Type select Standard .
- Select option Delete , traffic to subdirectories and that contains .
- In Subdirectory type it, /wp-admin/
(This path is present on all admin panel pages).
Okay, now the data of your new View created should be clean of false page views and hits.