Documentation menuGet started: Script troubleshooting

Get started

Fix a Loogika script that sends no data

When the dashboard stays empty, the cause is almost always one of six things. Work through the checks in order. The first one takes ten seconds.

Last updated .

How do you check that the script has loaded?

Open your site, open the browser console and type loogika.

A working install returns an object with functions such as event, pageview and identify. If the console answers ReferenceError: loogika is not defined, the script did not load.

Then send a test event:

loogika.event("test_event");

The event shows up under Events in the dashboard after a few seconds. In the Network tab you should also see requests to /api/track that return status 200.

What are the common causes?

SymptomCauseFix
loogika is not definedThe script did not loadCheck that the tag is on the page and inside the head element
Console says "Please provide a valid site ID" A plugin removed the data attributes from the tagPut the site ID in the URL, as shown below
Works for you, but numbers look lowAd blockers stop the script for some visitorsServe the script from your own domain through a proxy
Script loads, dashboard is emptyThe site ID belongs to another siteCompare the ID in the tag with the one in Site Settings
Console shows a Content Security Policy errorYour CSP does not allow the Loogika domainAdd the two directives below
First pageview is missing in a React, Vue or Next.js appThe script loads after the first renderMove the tag to the root template

What if a plugin rewrites the script tag?

Caching and optimisation plugins can delay scripts and drop their data attributes. Tag managers and some site builders do the same.

Use the URL form, which keeps the site ID in the address:

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

If the tool also rewrites the src attribute, add the script with JavaScript:

const s = document.createElement("script");
s.src = "https://app.loogika.com/api/script.js?siteId=YOUR_SITE_ID";
s.defer = true;
document.head.appendChild(s);

What do you add to a Content Security Policy?

Allow Loogika as a script source and as a connection target:

script-src 'self' https://app.loogika.com;
connect-src 'self' https://app.loogika.com;

Where should the tag go in a single-page app?

Put it in the root HTML template, for example index.html. In Next.js, use the root document or layout.

A tag that is added from inside a component can load after the first page has rendered. The first pageview is then lost.

What if none of this helps?

Look for failed requests to app.loogika.com in the Network tab. Then check your own filters. An IP exclusion or a country exclusion in Site Settings can remove your visits from the reports.

If the script works and the data is still missing, write to [email protected] with your site ID.