Troubleshooting
Debug common issues with the Mythic Analytics JavaScript SDK including missing events, blocked requests, and configuration problems.
Troubleshooting
No events appearing
Verify initialization
Confirm init is called with a valid publishable key. With the CDN loader:
window.mythic.init("pk_your_publishable_key");
Check window.mythic.loaded === true once the core has finished loading.
Enable debug logging
window.mythic.init("pk_your_publishable_key", { debug: true });
You should see logs when capture or pageview fires and when events are sent.
Check network requests
Open the browser network panel and filter by /e?key= or /decide?key=. Verify requests reach the expected api_host.
Events are captured but not sent
- Consent gating: with
requireConsent: true(orautoConsentMode), events are silently dropped untilgrantConsent()is called. - Do Not Track: if
respect_dnt: trueand the browser has DNT / Global Privacy Control on, tracking is disabled at init. - Test mode:
test_mode: truelogs events to the console instead of sending them. - Batching: events are held until
batch_size(default 10) orflush_interval(default 2000ms) is reached. Callflush()to send immediately. - Buffering for framework data: with
auto_framework_extractenabled, the first events are briefly buffered until page context is extracted (up to a 2s safety timeout). Setwait_for_page_data: falseto disable this. - Bot detection: requests from user agents detected as bots are still captured, but you can check
isBot()to gate your own calls.
Error tracking captures manual test throws but no real errors
If a manual throw from the console (e.g. setTimeout(() => { null.boom }, 0)) produces an $exception but the site's actual load-time errors never appear, the loader is being installed too late — usually because it's injected through a tag manager (e.g. GTM). The loader can only capture errors thrown after it executes, so a tag manager's own initialization errors (and anything before the container) fire before the listeners exist.
Fix: load the CDN loader directly in <head>, above the tag-manager container. Confirm with window.__mythicErr in the console — it should be an object ({ q, sink }); if it's undefined, the early error-capture stub hasn't run yet on the page. window.mythic.getConfig().error_tracking should be true.
Network requests blocked
- If blocked by ad blockers or CSP, serve Mythic via a custom subdomain and update
api_host. - If requests fail with
4xx, check that the key is correct and not expired. - If requests fail with
5xx, retry later or contact support.
Wrong host or key
// Fix the configuration and redeploy
const mythic = init("pk_your_correct_key", {
api_host: "https://analytics.yourdomain.com",
});
Verify in the network panel that the key query parameter matches your Mythic project key.