Install on WordPress
Install XPmetric's combined WordPress plugin for crawler and human pageviews, with manual script placement as an alternative.
Use one XPmetric plugin to record crawler requests with their real response codes and, optionally, add browser tracking for human pageviews.
Replace YOUR_SITE_TOKEN with your site token from Settings → Sites → Get Script.
Recommended: XPmetric Bot Tracker plugin
Download XPmetric Bot Tracker 1.2.0 and its SHA-256 checksum. In WordPress admin, go to Plugins → Add New Plugin → Upload Plugin, upload the ZIP, install it, and activate it.
Open Settings → XPmetric Bot Tracker. Copy the site token from XPmetric Settings → Sites → Get Script, paste it into the plugin, and turn on Enable bot tracking if you want crawler reports. Click Save Changes.
Human pageviews are on by default for a new install: Inject tracking script in the site head under Human analytics tracking starts checked, so saving the token also adds the browser script. A site that already saved its settings in an earlier version keeps its saved choice, including off. Choose Tracking mode to match that site's tracking mode in XPmetric Settings → Sites → Site before you save:
- Cookieless loads
https://xpmetric.com/p.js. - Cookie loads
https://xpmetric.com/p.cookie.jsand stores a first-party visitor cookie.
The plugin displays the script URL before injection. Check that it matches your site's selected mode. It scans active WPCode snippets and the rendered page before enabling injection. If it finds an XPmetric script, or cannot confirm that the page is clear, it refuses to enable injection and shows a notice. If your existing script already tracks your visitors, no action is needed. To switch to plugin injection, remove or disable the existing WPCode or theme script, then save again. To keep your current placement without a notice, uncheck Inject tracking script in the site head. Do not load the same XPmetric script twice.
Cookie mode adds the script automatically. If your site uses a consent tool, configure it to load the script only after analytics consent, or leave plugin injection off and let the consent tool add it. XPmetric does not include a consent tool. Depending on where your visitors are, you may need a consent banner before loading cookie-mode tracking.
Click Send test hit and check for /xpmetric-test in the Bot Traffic card. To verify human tracking, visit a page and check for a pageview in your XPmetric dashboard. If your page cache exits before WordPress loads, use the WordPress page-cache fallback.
Alternative: add the browser script yourself
If you already manage the XPmetric script with WPCode or a theme, keep that setup and uncheck Inject tracking script in the site head in the plugin. The plugin can still report crawler visits. Use the snippet below only when no other XPmetric script is already installed.
<script defer data-site="YOUR_SITE_TOKEN" src="https://xpmetric.com/p.js"></script>WPCode
- In WordPress admin, go to Plugins → Add New and search for WPCode.
- Install and activate WPCode.
- Open Code Snippets → Header & Footer.
- Paste the snippet into the Header box and save.
Child theme
- Go to Appearance → Theme File Editor.
- Open
header.phpin a child theme so theme updates do not overwrite the change. - Paste the snippet just before
</head>and save the file.
Related
- XPmetric Bot Tracker guide for crawler tracking, test-hit results, and cache fallback details
- Cookie and cookieless tracking modes
- CSP troubleshooting if tracking stays silent
- Custom goals for form signup events