Documentation menuContent management systems: Storyblok

Content management systems

Add Loogika to Storyblok

Storyblok is a headless CMS (content management system). Storyblok holds the content and hands it out through its APIs, and your frontend builds the pages from it. The Loogika tag therefore goes into the root layout of that frontend, not into Storyblok.

Last updated .

What do you need before you start?

Copy your script tag from Site Settings in Loogika, under the Tracking Script tab. It looks like this, with your own site ID in place of YOUR_SITE_ID:

<script src="https://app.loogika.com/api/script.js?siteId=YOUR_SITE_ID" defer></script>

Where does the Loogika tag go on a Storyblok site?

Place the tag in the <head> of whichever frontend application pulls its content from Storyblok. Storyblok has no template and no header setting to paste code into. Pick the guide for your framework:

Loogika records route changes inside the app as pageviews while SPA Navigation is on in Site Settings, which is the default. Moving between stories needs no extra code in any of these frameworks.

How do you check that Loogika is installed?

Visit the live frontend in another browser tab and open a few pages. Loogika's dashboard shows those pageviews within a few seconds. If nothing arrives, check whether the page source contains script.js?siteId=.

Do Visual Editor previews count as visits?

Yes. Your frontend opens inside an iframe in the Visual Editor, which uses the Preview URL you set under Settings, then Visual Editor. Loogika counts an editor in that iframe like any other visitor.

To keep editors out of your numbers, give previews a deployment of their own and enter its address as the Preview URL. Register that deployment in Loogika as a site of its own, or drop the tag from every build that uses the preview token.

Why do tracked URLs contain _storyblok parameters?

The Visual Editor adds _storyblok and _storyblok_tk[...] query parameters to the Preview URL. If the live site and the Visual Editor share a single deployment, those parameters end up in your page reports.

You can turn off URL Parameters in Site Settings, on the Tracking tab, and Loogika stops storing query strings. That switch removes UTM campaign parameters as well. If you track campaigns, a preview deployment of its own solves the problem better.

Does Loogika track the Storyblok app?

No. The tag runs only in your frontend, so the time editors spend on app.storyblok.com never shows up in Loogika.