← Install guides

Add Hark to a Ghost blog

Ghost's code injection adds the snippet to every page, with no theme changes.

The code below is for example.com. Replace it with your site's domain.

  1. 1

    Open Settings → Code injection

    In Ghost Admin's settings, find Code injection (under Advanced in recent versions). Paste the snippet into Site header, then save.

    Site header

    <script defer data-domain="example.com" src="https://harkstats.com/js/script.js"></script>
  2. 2

    Visit your site

    Your site's settings page in Hark shows "Receiving events" when the first pageview arrives.

Not seeing visits?

  • Your site's settings page in Hark says "Receiving events" once the first pageview arrives. It updates by itself, so keep it open while you visit your site.
  • data-domain must be the domain you added to Hark, without https:// or www.
  • Visits from localhost aren't counted. Add a data-local attribute to the tag to test on your machine.
  • Check your published page's source for the tag: caching plugins and CDNs can serve an old copy.
  • Some ad blockers block analytics scripts, including this one; try another browser to rule that out.
  • To leave your own visits out, run localStorage.analytics_ignore = "true" in your browser's console on your site.

No site yet? The trial is free, with no card.

Start your free trial