Installation

WordPress Plugin

Install Sonar on WordPress with the official plugin or a header snippet.

  1. In your WordPress admin, go to Plugins → Add New.
  2. Search for Sonar Analytics.
  3. Click Install Now, then Activate.
  4. Go to Settings → Sonar Analytics and paste your Site Key. In Sonar, you'll find it under Site settings → Tracking code.
  5. 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.php are 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.