Google Analytics measures all WordPress traffic. Coming from real visitors, bots or admins and editors. It’s all traffic for Google Analytics. Even when previewing a post. This behavior is normal. It’s what Google Analytics should do. Track all traffic and stats when the Google Analytics code loads.

Why Google Analytics Doesn’t Exclude WordPress Admin Traffic By Default

You must be wondering. Why Google Analytics can’t exclude all WordPress admin traffic by default? The reason is simple. Google Analytics script loads every time your WordPress Theme loads. When previewing a post, WordPress loads the active theme. Which includes all its files. Like header, footer, CSS, images etc.

Google Analytics code snippet loads from the WordPress header file. When previewing a post, WordPress loads the active WP Theme to show exactly how the post will look like before you hit publish. All CSS, all images, all scripts are there. Including Google Analytics.

Are you getting it? An admin or an editor wants to preview a post. He wants to see exactly what visitors will see. Before hitting publish. That’s why every WordPress post preview counts as a visit and pageview for Google Analytics.

It’s easy to exclude this WordPress admin traffic from Google Analytics. All you need to do is create a filter with a unique pattern. Google Analytics even lets you preview the filter.

Create Google Analytics Custom Filter For WordPress Admin

  1. Log in to Google Analytics
  2. Selected your website
  3. Click on Admin
  4. Under the View menu select Filters
  5. Create New Filter
  6. Type the name of the new filter. eg WPAdmin
  7. Select Custom
  8. Exclude Request URI
  9. In Filter pattern type: preview=true
  10. Verify this filter

How To Test Google Analytics WPAdmin Exclude Traffic Filter

This is an easy one. After you saved the new exclude WordPress admin traffic filter go back to Google Analytics. Click on the Real-Time stats.

Now login to WordPress and write a test post. Don’t publish it. Just hit preview.

Now go back to Google Analytics Real-Time stats. You should see no activity based on the preview post URL. Nothing at all. The new WPAdmin filter for excluding traffic is now working.

Will Google Analytics New Exclude Traffic Filter Slow Down WordPress?

Absolutely not. What happens in Google Analytics, stays in Google Analytics. WordPress performance and speed will stay intact. The new filter is something for Google servers and algorithms to take into account. It doesn’t affect WordPress performance at all. Your site will load as fast as it did before.

[photo]

Show CommentsClose Comments

Leave a comment