ReferenceConfiguration
Reference

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

api_hoststring

Base URL for API calls. Default: https://mythic-analytics.gulp.workers.dev. Change this if you use a custom domain or proxy.

batch_sizenumber

Number of events to queue before sending. Default: 10.

flush_intervalnumber

Milliseconds between automatic flushes. Default: 2000.

xhr_headersobject

Custom headers to include with every network request.

Auto-capture

autocaptureboolean|object

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'] }.

capture_pageviewboolean

Auto-capture a $pageview event on page load. Default: true.

capture_spa_pageviewboolean

Auto-capture page views on SPA navigation (History API pushState/replaceState). Default: true.

capture_pageleaveboolean

Auto-capture a $pageleave event with time-on-page and exit intent data. Default: true.

capture_utmboolean

Auto-capture UTM parameters and advertising click IDs from the URL. Default: true.

capture_copied_textboolean

Track text copied to clipboard. Default: false.

Privacy and persistence

persistencestring

Storage strategy. Options: 'localStorage', 'cookie', 'memory', 'localStorage+cookie'. Default: 'localStorage+cookie'.

persistence_namestring

Custom prefix for storage keys. Defaults to {globalName}_{key}_.

respect_dntboolean

Honor the browser's Do Not Track setting. Default: false.

opt_out_capturing_by_defaultboolean

Start with tracking disabled. Requires explicit opt_in(). Default: false.

requireConsentboolean

When true, no events are sent until grantConsent() is called. Default: false.

autoConsentModeboolean|object

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

allowReidentificationboolean

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_timeoutnumber

Session timeout in milliseconds. After this period of inactivity, a new session starts. Default: 30 minutes.

Debugging

debugboolean

Enable verbose console logging. Default: false.

verboseboolean

Even more detailed logging (includes internal state). Default: false.

test_modeboolean

Log events to console instead of sending them. Useful for development. Default: false.

HIPAA compliance

hipaaboolean

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.

max_storage_durationnumber

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_all_textboolean

Mask text content in autocaptured events. Force-enabled in HIPAA mode.

mask_all_element_attributesboolean

Mask element attributes in autocaptured events. Force-enabled in HIPAA mode.

Callbacks

loadedfunction

Called with the Mythic instance after initialization completes. Signature: (instance) => void.

before_sendfunction

Transform or filter events before sending. Return the event to send it, or null to drop it. Signature: (event) => event | null.

sanitize_propertiesfunction

Modify properties before they are attached to an event. Signature: (properties, eventName) => properties.

on_xhr_errorfunction

Called when a network request fails. Signature: (error) => void.

Advanced auto-tracking

auto_form_identifyboolean

Automatically identify users from email fields on form submission. Default: true.

auto_input_captureboolean

Capture email addresses as they are typed into input fields. Default: true.

auto_booking_listenerboolean

Automatically detect and track booking widget interactions (Calendly, etc.). Default: false.

auto_survey_trackingboolean

Automatically track survey widget responses. Default: false.

auto_network_interceptboolean|object

Intercept fetch/XHR requests to specified endpoints and capture them as events. Default: false.

auto_framework_extractboolean|object

Extract page metadata from frameworks (Nuxt, Next.js, React, Vue, Angular). Default: false. Pass { framework: 'auto' } for auto-detection.

auto_gtm_syncboolean

Sync events to Google Tag Manager's dataLayer. Default: true.

wait_for_page_databoolean

Buffer events until framework extraction completes. Default: false.

Web Vitals

web_vitalsboolean|object

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

geolocationboolean|object

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

cross_domain_trackingboolean|object

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

rate_limitingobject

Client-side rate limiting. Example: { events_per_second: 10, events_burst_limit: 50 }.