Configuration Reference
Complete reference for all Mythic Analytics JavaScript SDK configuration options including network, auto-capture, privacy, consent, HIPAA, and more.
Configuration reference
The full set of options you can pass to init(key, config).
Network and batching
Base URL for API calls. Default: https://mythic-analytics.gulp.workers.dev. Change this if you use a custom domain or proxy.
Number of events to queue before sending. Default: 10.
Milliseconds between automatic flushes. Default: 2000.
Custom headers to include with every network request.
Auto-capture
Enable automatic capture of clicks, form submissions, and DOM interactions. Default: true. Pass an object to limit to specific element types: { elements: ['links', 'buttons', 'forms'] }.
Auto-capture a $pageview event on page load. Default: true.
Auto-capture page views on SPA navigation (History API pushState/replaceState). Default: true.
Auto-capture a $pageleave event with time-on-page and exit intent data. Default: true.
Auto-capture UTM parameters and advertising click IDs from the URL. Default: true.
Track text copied to clipboard. Default: false.
Privacy and persistence
Storage strategy. Options: 'localStorage', 'cookie', 'memory', 'localStorage+cookie'. Default: 'localStorage+cookie'.
Custom prefix for storage keys. Defaults to {globalName}_{key}_.
Honor the browser's Do Not Track setting. Default: false.
Start with tracking disabled. Requires explicit opt_in(). Default: false.
Consent
When true, no events are sent until grantConsent() is called. Default: false.
Automatically sync consent from Google Consent Mode v2 via the dataLayer. When enabled, forces requireConsent: true. Pass an object for custom settings: { enabled: true, consentParam: 'analytics_storage', dataLayerName: 'dataLayer' }.
Identity
Allow calling identify with a different user ID on the same device. Default: true. Set to false to preserve the first identity and prevent accidental merges.
Session
Session timeout in milliseconds. After this period of inactivity, a new session starts. Default: 30 minutes.
Debugging
Enable verbose console logging. Default: false.
Even more detailed logging (includes internal state). Default: false.
Log events to console instead of sending them. Useful for development. Default: false.
HIPAA compliance
Enable HIPAA mode. Applies a hipaaFilter to all outgoing events and force-disables autocapture, form identification, geolocation, cross-domain tracking, cookies, AI chat, and other features that could expose PHI. Default: false.
Maximum hours to retain data in local storage. Only relevant in HIPAA mode. Default: 24 (in HIPAA mode).
HIPAA mode reduces the risk of sending sensitive data but does not guarantee compliance. Review your event schemas and legal requirements with your compliance team.
Masking
Mask text content in autocaptured events. Force-enabled in HIPAA mode.
Mask element attributes in autocaptured events. Force-enabled in HIPAA mode.
Callbacks
Called with the Mythic instance after initialization completes. Signature: (instance) => void.
Transform or filter events before sending. Return the event to send it, or null to drop it. Signature: (event) => event | null.
Modify properties before they are attached to an event. Signature: (properties, eventName) => properties.
Called when a network request fails. Signature: (error) => void.
Advanced auto-tracking
Automatically identify users from email fields on form submission. Default: true.
Capture email addresses as they are typed into input fields. Default: true.
Automatically detect and track booking widget interactions (Calendly, etc.). Default: false.
Automatically track survey widget responses. Default: false.
Intercept fetch/XHR requests to specified endpoints and capture them as events. Default: false.
Extract page metadata from frameworks (Nuxt, Next.js, React, Vue, Angular). Default: false. Pass { framework: 'auto' } for auto-detection.
Sync events to Google Tag Manager's dataLayer. Default: true.
Buffer events until framework extraction completes. Default: false.
Web Vitals
Capture Core Web Vitals (LCP, FID, CLS, FCP, TTFB, INP). Default: false. Pass an object for fine-grained control: { enabled: true, metrics: ['LCP', 'CLS', 'INP'], sample_rate: 0.5 }.
Geolocation
Enrich events with geolocation data. Default: enabled at city level. Pass an object for control: { enabled: true, level: 'country' | 'region' | 'city', cache_duration: 3600 }. Set to false to disable.
Cross-domain tracking
Track users across domains by decorating links with session IDs. Opt-in only. Default: false. Pass { enabled: true, domains: ['app.example.com', 'docs.example.com'] }.
Rate limiting
Client-side rate limiting. Example: { events_per_second: 10, events_burst_limit: 50 }.
Last updated today