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?
| Symptom | Cause | Fix |
|---|---|---|
loogika is not defined | The script did not load | Check 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 tag | Put the site ID in the URL, as shown below |
| Works for you, but numbers look low | Ad blockers stop the script for some visitors | Serve the script from your own domain through a proxy |
| Script loads, dashboard is empty | The site ID belongs to another site | Compare the ID in the tag with the one in Site Settings |
| Console shows a Content Security Policy error | Your CSP does not allow the Loogika domain | Add the two directives below |
| First pageview is missing in a React, Vue or Next.js app | The script loads after the first render | Move 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.