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

1

Open custom code

Open the WordPress with a header/footer plugin or theme header custom code or template area.

2

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>
3

Publish

Save the change and publish the site.

Options / Configuration

OptionTypeRequiredDescription
data-sitestringYour Grometrics site ID
deferbooleanLoads 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?