WordPress
Add the Grometrics script to WordPress with a header/footer plugin or theme header.
Last updated June 3, 2026
Add the Grometrics tracking script to WordPress with a header/footer plugin or theme header. Pageviews, sessions, UTMs, and revenue attribution start after the script loads.
Prerequisites
- A Grometrics site ID from Settings > Tracking
- Access to the site, theme, or app code
- A way to publish the change
Steps
Open custom code
Open the WordPress with a header/footer plugin or theme header custom code or template area.
Paste the script
Add the script before the closing head tag.
Replace YOUR_SITE_ID with your site ID from Settings > Tracking.
WordPress Header
1<script defer src="https://cdn.grometrics.io/g.js" data-site="YOUR_SITE_ID"></script>Publish
Save the change and publish the site.
Options / Configuration
| Option | Type | Required | Description |
|---|---|---|---|
| data-site | string | ✓ | Your Grometrics site ID |
| defer | boolean | ✓ | Loads tracking without blocking rendering |
What happens next
Open the site once after publishing. Realtime should show the first pageview within a few seconds.
Verify your setup
Verify your setup
Troubleshooting
No event appears
Confirm the site ID matches Settings > Tracking and that the latest published code is running.
Was this page helpful?