Add cookieless analytics to WordPress without a plugin
To add analytics to WordPress without a plugin, put one <script> tag in your theme's <head>. The update-safe way is a child theme's functions.php with the wp_head hook; the quick way is header.php in the Theme File Editor. For Simplytics that tag is ~1.8 KB and sets no visitor cookies.
WordPress loads a full page on every click, so a tag in <head> counts every view. There is no route-change code to write.
Does WordPress analytics need a plugin?
No. MonsterInsights, Google's Site Kit and the vendors' own plugins exist because an admin screen is easier than editing a theme. A tracking tag is one line of HTML, and WordPress has a hook built for it. A "header and footer" snippet plugin such as WPCode also survives theme updates, but it is still a plugin.
How each tool documents a no-plugin install (checked 18 October 2026):
| Tool | No-plugin method in its docs | Sets cookies? |
|---|---|---|
| Simplytics | One <script> in the head, via a child theme's wp_head or header.php |
No |
| Plausible | None: its WordPress page documents only its plugin | No |
| Fathom | One line ("paste your script into your footer theme file"), no steps | No |
| Google Analytics 4 | "Paste your Google tag immediately after the <head>", but Google steers you to Site Kit |
Yes, by default |
Plausible, Fathom and Simplytics set no cookies, so none adds a cookie-consent prompt of its own. At ~1.8 KB gzipped, the Simplytics tag is a fraction of GA4's ~140 KB (measured June 2026; see how much JavaScript each analytics tool ships).
Where to put the tag
This is the tag, with your site key in data-key:
<script async src="https://simplytics.dev/track.js" data-key="YOUR_KEY"></script>
YOUR_KEY is the public site key from your dashboard, so it is safe to commit.
Recommended: a child theme and wp_head
wp_head is WordPress's hook for "scripts or data in the head tag on the front end". A child theme is never overwritten when the parent theme updates, and the hook fires on classic and block themes alike. Add this to your child theme's functions.php:
add_action('wp_head', function () {
?>
<script async src="https://simplytics.dev/track.js" data-key="YOUR_KEY"></script>
<?php
});
Quick but fragile: header.php
- In the admin, go to Appearance → Theme File Editor.
- Open
header.php. - Paste the tag just before
</head>and save.
This works at once, but a theme update wipes your edit to the parent theme's header.php. Most "no plugin" guides skip that.
Block (Full Site Editing) themes have no header.php. The header is a block template part, and the code editor moved to Tools → Theme File Editor. Use the child-theme route.
No Theme File Editor at all? It has been turned off by define('DISALLOW_FILE_EDIT', true); in wp-config.php, a security plugin or your user role. Use a child theme, or ask whoever runs the site.
Check the first hit
- Open a page on your live site. Views from
localhostor staging are refused because the hostname must match a site on your account; add a staging subdomain as its own site to test there. - In DevTools, open Network and filter for
track. You should see aPOSTtohttps://simplytics.dev/trackthat returns{"status":"success"}. - View the page source (Ctrl/Cmd-U) and confirm the
track.jstag is inside<head>. - Open your dashboard. The site shows as verified once a valid hit arrives. On a new account, that first view starts the 30-day free trial, no card needed.
No request in step 2? A caching plugin is usually serving an old copy of the page: purge it and reload. A browser that sends Global Privacy Control (Brave and DuckDuckGo do by default) also sends nothing, by design.
Exclude your own visits
Simplytics sets no visitor cookie and stores no raw IP address in its analytics database. Country comes from an edge header, and the identifier is a short-lived daily hash, removed within two nights. So the dashboard has no "exclude me" switch. Use one of these instead:
Skip logged-in users. Wrap the hook so the tag never renders for you or your editors:
add_action('wp_head', function () { if (is_user_logged_in()) { return; } ?> <script async src="https://simplytics.dev/track.js" data-key="YOUR_KEY"></script> <?php });Switch off your own browser. On your live site, run
localStorage.simplytics_ignore = '1'in the DevTools console. The tag then sends nothing from that browser on that site.
When a plugin or another tool fits better
- You want reports inside wp-admin. Site Kit and MonsterInsights show GA4 reports in the WordPress dashboard. Simplytics has its own dashboard on its own domain.
- You need WooCommerce revenue or per-shopper journeys. Simplytics counts page views and reports countries, not cities, and keeps no long-lived per-visitor identifier. GA4 or Matomo fit better.
- You can't edit files and won't add a child theme. A header-snippet plugin is simpler there.
Plausible and Fathom are cookieless too. Simplytics differs on the plain install, a primary analytics database in Warsaw, raw rows deleted nightly with no scheduled expiry for the daily totals you keep, and price: $1/month, billed yearly ($12/year for 50,000 page views a month across up to 12 sites, with a 30-day trial and no card), against Plausible's $9/month. Compare Simplytics vs Plausible and vs Google Analytics, try the demo, or see pricing.
On a JavaScript framework instead? See Astro and Next.js App Router.
Competitor install methods reflect each vendor's WordPress or placement docs; WordPress details reflect the current wp_head reference and Theme File Editor behaviour. Last verified: 2026-10-18.