SR
Usage

Twig Functions

Use Twig functions to add tracking to your templates.


trackingScript()

Registers the tracking script via Craft's asset bundle system.

{{ craft.insights.trackingScript() }}
Note

Technically it's not important where you add the script on your page as it always injects the script at the end of the body.

trackingScriptInline()

Outputs the tracking script as inline JavaScript.

{{ craft.insights.trackingScriptInline()|raw }}

Use this when asset bundles aren't available (e.g., in certain caching scenarios).


Copyright © 2026 Samuel Reichör