Install Statsdot on WordPress
Updated October 13, 2026
There are two ways to add Statsdot to WordPress. Use the first one if you prefer not to touch code.
Option 1: a header and footer plugin
- In your WordPress admin, go to Plugins → Add New and install a plugin that inserts code in the header, such as WPCode.
- Open its Header section and paste your snippet:
<script defer data-domain="yoursite.com" src="https://statsdot.com/js/script.js"></script>
- Save. The script now loads on every page of the site.
Option 2: your child theme
If you use a child theme, add this to its functions.php:
add_action('wp_head', function () {
echo '<script defer data-domain="yoursite.com" src="https://statsdot.com/js/script.js"></script>';
});
Do not edit the parent theme directly: updates would remove the change.
Caching and optimisation plugins
Plugins that combine, minify or delay JavaScript (WP Rocket, Autoptimize, LiteSpeed Cache and others) can rewrite the script tag and lose the data-domain attribute. Add statsdot.com/js/script.js to their list of excluded scripts, then clear the cache.
Logged-in users
WordPress admins visit their own site a lot. To leave your visits out, open your site, open the browser console and run localStorage.setItem('statsdot_ignore', '1') once in each browser you use.
Check that it works
Visit your site in a private window and look at the dashboard: you should appear among the visitors on the site right now within a few seconds.