Skip to content
Install guide · CMS & blogs

Install Linqry on Ghost

To add Linqry to a Ghost site, open **Settings → Code injection** in Ghost Admin and paste the two-line snippet into the **Site header** field. Ghost adds it to the `<head>` of every page, so posts, pages, tag archives and the homepage are all tracked.

Updated · 2 min read

Install with Code injection

  1. Add your publication to Linqry

    Start a free trial, add your Ghost site's domain (your custom domain if you use one) and copy the snippet from the Install page.

  2. Open Code injection

    In Ghost Admin, go to Settings → Code injection. Code in Site header is injected into the <head> of every page; Site footer goes before </body>. Use the header.

  3. Paste the snippet and save

    Paste both lines into Site header and save.

    <script>window.linqry=window.linqry||function(){(window.linqry.q=window.linqry.q||[]).push(arguments)}</script>
    <script defer data-website-id="YOUR_SITE_ID" data-domain="yourdomain.com" src="https://linqry.com/t.js"></script>
  4. Verify in Realtime

    Open your site in a private window and read a post, then open Realtime in Linqry. The page view appears in the live event stream within seconds.

Which domain to register

Register the domain readers actually see. If your publication is reachable on two hostnames, for example a custom domain and the platform's default subdomain, either register the custom domain and add the other under Additional hosts in site Settings, or leave it out so only the canonical domain is counted.

Track Portal signup clicks

Ghost's Portal opens from links like #/portal/signup (relative links open it on the current page) and from elements with a data-portal attribute in your theme. The signup itself happens inside Portal and is confirmed by email, so the snippet can't reliably see a completed signup, but it can count how often readers open the signup screen. Paste this into Site footer:

<script>
  document.addEventListener("click", function (e) {
    var el = e.target.closest('a[href*="#/portal/signup"], [data-portal^="signup"]');
    if (el) window.linqry("portal-signup-opened", { page: location.pathname });
  });
</script>

Combine that with a funnel from post view to portal-signup-opened to see which posts move readers toward subscribing. To count completed paid signups, send an event from your own server when the payment is confirmed (for example from a Stripe webhook), using the site's write key and the tracking API.

Newsletters, campaigns and referrers

Linqry reads UTM parameters from the landing URL, so links in your newsletter, social posts or sponsorship spots can be told apart if you tag them, for example ?utm_source=newsletter&utm_medium=email&utm_campaign=issue-42. The UTM builder generates these links. Visits from other websites show their referrer automatically, and links from your posts to other sites are recorded as outbound events.

Excluding your own visits

Writers check their own posts a lot. In each browser you use, open your site and run this once in the console; that browser then stops sending events:

localStorage.setItem('linqry_ignore', 'true')

Troubleshooting

  • Nothing in Realtime? View the page source of a post and search for t.js. If it's missing, check you saved the Site header field. If it's present, compare the site ID with the Install page.
  • Theme doesn't output the snippet? Site header code is printed by Ghost's {{ghost_head}} helper, which belongs just before </head> in the theme's default.hbs. If a custom theme leaves it out, ask its developer to add it.
  • Testing with an ad blocker? Use a clean browser profile; some blockers block analytics scripts.

Frequently asked questions

Can I run Linqry alongside another analytics tool on Ghost?

Yes. Scripts in Code injection run independently of each other. Expect the numbers to differ somewhat, because every analytics tool identifies visitors and filters bots in its own way.

Does Linqry track email opens?

No. Linqry measures visits to your website. It can show how many visitors arrived from a newsletter if you tag the links with UTM parameters, but it doesn't track email opens or clicks inside the email itself.

Sources

  1. Ghost: How to use Code Injection (checked Nov 9, 2026)
  2. Ghost Docs: Members and Portal links in themes (checked Nov 9, 2026)
  3. Ghost Docs: ghost_head and ghost_foot helpers (checked Nov 9, 2026)

Start measuring your Ghost site

No card required · 30-day trial · No cookies