Installation
WordPress Plugin
Install Sonar on WordPress with the official plugin or a header snippet.
Option 1: The Sonar plugin (recommended)
- In your WordPress admin, go to Plugins → Add New.
- Search for Sonar Analytics.
- Click Install Now, then Activate.
- Go to Settings → Sonar Analytics and paste your Site Key. In Sonar, you'll find it under Site settings → Tracking code.
- Click Save settings.
The plugin adds the tracking code to every page, and it keeps working when you change themes. By default it doesn't count logged-in administrators and editors, so your own browsing doesn't skew your numbers. Check in a private window to see your visit arrive.
Option 2: Add the snippet yourself
If you can't install plugins (some managed WordPress hosts restrict them), add the snippet to your theme instead.
Use a header/footer plugin such as WPCode, or edit your child theme's header.php. Paste this before </head>:
<script async src="https://sonar-app.co.uk/tracker.js" data-site-key="YOUR_SITE_KEY"></script>
Note: Edits to a parent theme's
header.phpare lost when the theme updates. Use a child theme or a plugin.
Caching plugins
If you use WP Rocket, W3 Total Cache or similar, clear the cache after installing so the snippet appears on cached pages.