Methods
Utility Methods
Access device, session, and configuration state with the Mythic Analytics SDK utility methods.
Utility methods
getDistinctId()
Returns the current distinct ID (anonymous or identified).
const distinctId = mythic.getDistinctId();
getSessionId()
Returns the current session ID.
const sessionId = mythic.getSessionId();
getDeviceId()
Returns the persistent device ID (5-year expiration).
const deviceId = mythic.getDeviceId();
isBot()
Returns true if the current user agent is detected as a bot.
if (mythic.isBot()) return; // Skip tracking for bots
debug(enabled?)
Toggle debug logging. When enabled, the SDK logs queued events, network requests, and configuration decisions to the console.
mythic.debug(true); // Enable verbose logging
mythic.debug(false); // Disable
getConfig()
Returns the current SDK configuration object.
const config = mythic.getConfig();
console.log(config.api_host);
updateConfig(newConfig)
Dynamically update configuration options at runtime.
mythic.updateConfig({ debug: true, batch_size: 5 });
refreshConfig()
Re-fetch remote configuration from the server.
await mythic.refreshConfig();
Was this page helpful?
Built with Documentation.AI
Last updated today