By default Google Analytics will track traffic generated by WordPress admins while previewing posts. This is how to remove admin preview traffic from Google Analytics.
- In Google Analytics, go to your admin panel
- In the third column (view), select “Filters”
- Choose “Add filter”
- Give it a name, for example “Exclude preview traffic”
- Choose “Custom” and “Request URI”
- Under Filter pattern, type in “preview = true”
- Click “verify”. In the left column, you should see that preview traffic is removed. Click save.
You can verify yourself by going to the Realtime section in Analytics. Open a new tab, go to your wordpress site and preview a post. This traffic should now not be visible in Realtime in Analytics.
Before making these changes, you should be able to observe it by opening a post in preview mode in WordPress, then going to the Realtime section in Analytics and observe it:
After the changes, this traffic should not be visible anymore.