HTML / Script tag
Add the Grometrics script to any HTML page.
Last updated June 3, 2026
Add the Grometrics tracking script to any HTML page. 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 any HTML page 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.
index.html
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?