Docs

WordPress

Two ways to add the script: a small snippet in your theme, or a header plugin if you prefer no code.

Prefer a managed alternative?

If you are comparing tools rather than installing one, read the Google Analytics alternative for WordPress guide. It covers the free plan, cookie-free tracking and when to keep Google Analytics.

Option A: theme (functions.php)

In your child theme's functions.php, hook the script into wp_head:

add_action( 'wp_head', function () { ?> <script defer src="http://localhost:3000/analytics.js" data-website-id="YOUR_TRACKING_ID"></script> <?php } );

Option B: header plugin

Use any "insert headers and footers" plugin, or your theme builder's custom-code area, and paste the plain snippet into the site head:

<script defer src="http://localhost:3000/analytics.js" data-website-id="YOUR_TRACKING_ID"></script>

Caching plugins

If you use a caching plugin, clear the cache after installing so the updated <head> is served.

Track custom events

Call the global function from your theme's JavaScript, a plugin, or an inline script:

lumen("Signup", { plan: "pro" });

Verify

Visit your site, then check the real-time view in your dashboard. The pageview should appear within seconds.