Storyblok
Add OnyxMetric analytics to a site that uses Storyblok
Storyblok is a headless CMS. It stores content and delivers it over its API, and your frontend renders the pages. Put the tag in that frontend.
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 Storyblok
Storyblok has no template or head setting to paste into. Add the snippet to the <head> of the frontend app that fetches content from Storyblok.
Load the script with next/script in your root layout so it runs on every route. Follow the Next.js guide.
Add the script under app.head.script in nuxt.config.ts. Follow the Nuxt guide.
Client-side route changes are tracked automatically, so moving between pages in any of these frameworks is counted without extra code.
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
- Visual Editor previews count as visits: the Visual Editor loads your frontend in an iframe at the Preview URL set under Settings > Visual Editor. Point it at a separate deployment registered as its own site.
- Preview parameters in URLs: if one deployment serves both the live site and the editor,
_storyblokparameters appear in tracked URLs. Strip them with a skip pattern or URL mask. - The Storyblok app is not tracked: the tag only runs in your frontend.
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.