Skip to content

WordPress proxy

The PureMetrix WordPress proxy runs the tracking script and visit data through your own domain, so ad blockers that block known analytics servers are less likely to drop visits.

What you configure

Template reference: adapters/proxy/WordPress plugin.

Finish the plugin setup wizard (Connect → Go live) first. Then open Settings → PureMetrix and enable Same-origin proxy. The plugin serves /px/js and /px/event without editing server configs.

Allowlist /px in security plugins after enabling.

Snippet shape

<script>window.puremetrix=window.puremetrix||function(){(window.puremetrix.q=window.puremetrix.q||[]).push(arguments)};</script>
<script async src="/px/js" data-domain="example.com" data-key="YOUR_PUBLIC_KEY" data-api="/px/event"></script>

With the WordPress plugin connected, the tracker is injected for you—you do not paste this snippet by hand. The shape above is what the plugin prints: a one-line queue (so puremetrix('…') calls never fail, even before the script has loaded), then the tracker loaded async from your own site. Proxy addresses start with / (no http:// or https://), so they work behind SSL proxies and load balancers. If the PureMetrix server is briefly unreachable, the plugin serves the last working copy of the script, so your pages never wait for it. After enabling proxy, pageviews should appear under app.puremetrix.org.

Troubleshooting

  • 403/404 on /px: a firewall blocks the path or the rewrite is missing.
  • Events are sent but no stats appear: reconnect in the wizard, or check that the domain matches under Settings → PureMetrix and in Site settings in the PureMetrix app. After moving a site to a new domain, the plugin shows a notice in WordPress until the domain is updated.
  • IP address or location wrong: the plugin passes on the visitor address that your web server sees. If your site runs behind Cloudflare, the plugin recognizes this automatically and uses the visitor address that Cloudflare reports, so there is nothing to set up. Addresses that visitors make up are ignored. Behind another reverse proxy, make sure your hosting passes the real visitor address on to WordPress.

Related