Skip to content

Analytics and tracking tools

Google Analytics and similar tools keep working on a site served by Edge Caching, with nothing to configure. A few WordPress plugins that count visits or read campaign parameters on the server need a different setting, because cached pages never reach WordPress.

Tools that run in the visitor’s browser work the same whether a page comes from the cache or from your server:

  • Google Analytics 4 and Google Tag Manager
  • Meta (Facebook) Pixel, LinkedIn Insight Tag, TikTok Pixel and other ad pixels
  • Matomo, Plausible and Fathom JavaScript trackers
  • Hotjar, Microsoft Clarity and other heatmap or session recording tools

The cached page contains the tracking <script> like any other part of the HTML, so the browser loads it and reports the visit. These tools set and read their cookies (_ga, _fbp, …) in the browser, so Edge Caching ignoring cookies for caching doesn’t affect them. Edge Caching also doesn’t add a Content-Security-Policy header, so nothing blocks third-party scripts.

Links from newsletters and ads carry tracking parameters such as utm_source or gclid. Edge Caching removes them before looking up the cache, so /pricing/?utm_source=newsletter and /pricing/ share one cached copy instead of rebuilding the page for every campaign link. The default list is utm_source, utm_medium, utm_campaign, utm_content, utm_term, fbclid, gclid and msclkid.

The address bar still shows the full link, so browser-based tools such as Google Analytics still see the campaign and attribute the visit correctly.

If you rely on such a plugin, either switch it to its JavaScript capture mode if it has one, or remove the parameters it needs under Cache Rules → Query String Cleaning → Strip Specific Parameters. Pages reached with those parameters are then cached separately for each value.

A page served from cache never runs PHP. Plugins that count a visit when WordPress builds the page miss every cached visit, so their numbers drop sharply. This affects, for example:

  • view counters and “popular posts” widgets in their PHP counting mode
  • WP Statistics and similar plugins in server-side tracking mode
  • membership or paywall plugins that count article views in PHP

Most of these plugins offer an AJAX or JavaScript counting mode, which counts every visit, cached or not. Enable it in the plugin’s settings.

Consent banners that decide in the browser what to show and which scripts to load, which is how most of them work (Complianz, CookieYes, Cookiebot and similar), work normally.

A banner that decides on the server, for example by checking a consent cookie in PHP before printing the tracking scripts, can’t work on cached pages: every visitor would get the version that was cached first. Use the plugin’s JavaScript mode, or add its consent cookie under Cache Rules → Exclude Cookies so visitors who have answered get pages from WordPress.

Requests blocked by the firewall, Protected Pages or geo blocking never reach your pages, so they never load the tracking scripts and don’t appear in your analytics. Most bots don’t run JavaScript anyway, so blocking them doesn’t change your visitor numbers.

The Total requests, Req / sec and Traffic by Country figures in the Edge Caching dashboard count every request reaching the edge, including bots, images and other files, whether cached or not. They won’t match the numbers in Google Analytics, which only counts page views from browsers that run its script and accept its cookies.

To confirm a tracking tool runs on a cached page:

  1. Open the page in a private window, where you’re not logged in to WordPress.
  2. Run curl -sI https://example.com/ | grep -i x-cache. HIT means the page came from the cache.
  3. Check the tool’s real-time view, for example Realtime in Google Analytics, or use the tool’s browser extension (Tag Assistant, Meta Pixel Helper). Your visit should appear.