See Live Visitors on WordPress With One Script Tag
Updated
TL;DR
To see live visitors on WordPress, add one script tag (under 4 KB gzipped) to every page, either in your theme with no plugin or through any "insert headers and footers" plugin, then open your site to watch each visitor's cursor live. It never changes how your pages look.
Using an AI coding agent? Give it this prompt:
Add whoisbrowsing (live visitor view) to this project. Follow https://whoisbrowsing.com/SKILL.md exactly.
Your snippet
<script src="https://live.whoisbrowsing.com/s.js" data-site="YOUR_SITE_ID" defer></script>
Replace YOUR_SITE_ID with the ID whoisbrowsing shows for your site. Create one with no sign-in if you do not have it yet.
Option 1: a plugin (easiest)
Any plugin that inserts code into your site header or footer works. Paste the snippet into the footer box and save. The plugin you pick does not matter to whoisbrowsing, it only has to print the tag on every page.
Option 2: no plugin, in your theme
WordPress's own guidance is to load scripts through wp_enqueue_script() hooked to wp_enqueue_scripts, and since WordPress 6.3 you can pass in_footer and a defer strategy (WordPress theme handbook). The enqueue function does not add custom attributes like data-site by itself, so the simplest no-plugin route is to print the tag from a hook in a child theme's functions.php:
add_action( 'wp_footer', function () {
echo '<script src="https://live.whoisbrowsing.com/s.js" data-site="YOUR_SITE_ID" defer></script>';
} );
Alternatively, paste the tag in your theme's footer.php just before </body>. Use a child theme, or a theme update will erase your change. A code-snippets plugin also works for the PHP version.
On managed WordPress.com, theme file editing depends on your plan: check your plan.
When to use which
| Situation | Use |
|---|---|
| You do not touch code | A header and footer plugin |
| You have a child theme | wp_footer hook |
| You edit theme files directly | footer.php before </body> |
Content-Security-Policy note
If your site sends a Content-Security-Policy header, allow the script and its live connection: script-src https://live.whoisbrowsing.com and connect-src wss://live.whoisbrowsing.com. Most WordPress sites send no such header, so you can usually skip this.
Verify
- In whoisbrowsing, click Watch for your site.
- Open your site in a Chrome Incognito or Safari private window. Your own normal browser is never counted, so a private window is how you test.
- You should see yourself as a coloured cursor on your real page, and one line for you in the side panel.
Each website is separate: www. and the bare domain count as the same website, but localhost and production never mix. If you see nothing, check that the site ID matches the one shown for this site.
If you see nothing on WordPress
- Clear your page cache. A caching plugin or host cache can keep serving pages saved before you added the tag. Purge it, then reload in the private window.
- Check optimisation settings. Plugins that combine, minify or delay JavaScript can hold a script back until the visitor interacts, or change how it loads. Exclude
live.whoisbrowsing.comfrom those features, and view the page source to confirm the tag still hasdata-site. - Check the right theme. If you edited a parent theme, an update may have replaced your change; use a child theme or a plugin.
- Running a WooCommerce store? The same tag covers your shop pages. See live visitors for e-commerce stores for what to watch.
Let your AI agent do it
Add whoisbrowsing (live visitor view) to this project. Follow https://whoisbrowsing.com/SKILL.md exactly.
This prompt works when your theme or site code lives in a project an agent can edit, where it can add the wp_footer hook for you. If you manage the site only in wp-admin, paste the tag with a plugin as above; an agent can still create the site for you and hand you the tag. See install with an AI agent.
Related
How it works, privacy, all install guides, or try it with no sign-in. Other platforms: Shopify, Webflow, Squarespace.