Integration Guides
Ghost
Add OnyxMetric analytics to your Ghost publication
Ghost has a built-in Code injection setting that adds HTML to the <head> of every page, so you do not need to edit your theme.
Copy your tracking snippet
In OnyxMetric, open your site's Site Settings and copy the tracking script. It looks like this:
<script src="https://app.onyxmetric.com/api/script.js?siteId=YOUR_SITE_ID" async></script>YOUR_SITE_ID is the numeric ID of your site.
Add the snippet to Ghost
- Open Ghost Admin and click the Settings gear at the bottom left.
- Under Advanced, open Code injection.
- Paste the snippet into Site header and click Save.
If you maintain your own theme, you can instead add the snippet to default.hbs just before </head>.
Check that it works
Load your live site and click through a few pages. Pageviews show up in the OnyxMetric dashboard within seconds.
If nothing arrives:
- View the page source and search for
script.js?siteId=to confirm the tag is present. - In the browser's Network tab, check that
script.jsreturns200and that requests go to/api/track. - Turn off ad blockers, or proxy the script through your own domain.
- Read script troubleshooting for other causes.
Troubleshooting
- Ghost(Pro) with a custom theme: code injection still applies on top of the theme, so prefer it over editing
default.hbs. - Members-only posts: gated pages are tracked like any other page for visitors who can view them.
- Portal and newsletter previews render in an iframe and are not tracked.
Next steps
- Track custom events such as signups, purchases, and clicks.
- Identify users to tie sessions to accounts.
- Proxy the script through your own domain to get past ad blockers.
- Script attributes let you skip or mask URLs and tag events.