Documentation menuDocumentation tools: GitBook

Documentation tools

Loogika and GitBook

Loogika cannot track pages that GitBook hosts. GitBook does not let you add a custom script to a published site, and the Loogika tag is a script. You can still measure the rest of your site with Loogika, or move the docs to a tool that accepts the tag.

Last updated .

Why can you not add the Loogika script to GitBook?

GitBook offers no supported way to load a third-party script on a published site. The old Custom scripts setting, with its Head field, has been removed.

The GitBook integration platform does not open the door either. Its documentation on integration scopes reserves the scope site:script:inject for integrations that GitBook builds itself. The same page states that outside developers cannot build an integration that injects JavaScript into a site or a space.

What can you do instead?

You have two options for the docs themselves.

  • Use the analytics that GitBook includes. For a published site, the GitBook app shows page views and search terms in its Insights section, and it needs no script.
  • Host the docs in a tool that takes the Loogika tag. GitBook can export a space as Markdown, which gives you the files to move.

Which documentation tools accept the Loogika tag?

These documentation tools take the tag directly. Each has its own install guide.

ToolWhere the tag goesGuide
DocusaurusThe scripts option in docusaurus.config.jsAdd Loogika to Docusaurus
MintlifyA small .js file in the content directoryAdd Loogika to Mintlify
VitePressThe head option in .vitepress/config.tsAdd Loogika to VitePress
StarlightThe head option in astro.config.mjsAdd Loogika to Starlight
FumadocsThe root layout, app/layout.tsxAdd Loogika to Fumadocs

How do you track the rest of your site?

Add the Loogika tag to the pages you host yourself, such as the marketing site, the blog and the app. Copy the tag from Site Settings in Loogika, under the Tracking Script tab:

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

The tracking script page explains where the tag goes and which options it takes. GitBook does not affect these pages, so they report to Loogika as usual.

How do you check the install?

Load a page that carries the tag in a fresh browser tab and visit a few pages. The pageviews show up in the Loogika dashboard within a few seconds. Pages that GitBook hosts never appear in Loogika, so test on your own pages only.