trackkit / index / InitOptions
Type Alias: InitOptions
InitOptions =
object
Defined in: types.ts:96
Properties
provider?
optionalprovider:ProviderType
Defined in: types.ts:105
Analytics provider type
Default
'noop'Example
'umami', 'plausible', 'ga4'site?
optionalsite:string
Defined in: types.ts:111
Generic alias for provider-specific site/property ID
Example
'G-XXXXXXXXXX' for Google Analyticshost?
optionalhost:string
Defined in: types.ts:117
Custom analytics host URL
Example
'https://analytics.example.com'allowWhenHidden?
optionalallowWhenHidden:boolean
Defined in: types.ts:125
Enable page tracking when the page is hidden
Default
falseautoTrack?
optionalautoTrack:boolean
Defined in: types.ts:131
Automatically track page views
Default
truebatchSize?
optionalbatchSize:number
Defined in: types.ts:137
Number of events to batch together
Default
10batchTimeout?
optionalbatchTimeout:number
Defined in: types.ts:143
Time in ms before forcing batch send
Default
1000bustCache?
optionalbustCache:boolean
Defined in: types.ts:149
Enable cache-busting (ie disable caching) for requests
Default
falsedebug?
optionaldebug:boolean
Defined in: types.ts:155
Enable debug logging to console
Default
falsedomains?
optionaldomains:string[]
Defined in: types.ts:160
Whitelist of domains to track
doNotTrack?
optionaldoNotTrack:boolean
Defined in: types.ts:166
Honor Do Not Track browser setting
Default
trueexclude?
optionalexclude:string[]
Defined in: types.ts:171
Exclude paths from tracking (Plausible)
includeHash?
optionalincludeHash:boolean
Defined in: types.ts:176
Include hash in URL for hash-router SPAs that need it
queueSize?
optionalqueueSize:number
Defined in: types.ts:182
Maximum number of events to queue before dropping oldest
Default
50trackLocalhost?
optionaltrackLocalhost:boolean
Defined in: types.ts:188
Track localhost events (Plausible)
Default
falsetransport?
optionaltransport:"auto"|"beacon"|"fetch"|"xhr"
Defined in: types.ts:194
Transport mechanism for sending events
Default
'beacon'batching?
optionalbatching:BatchingOptions
Defined in: types.ts:198
connection?
optionalconnection:ConnectionOptions
Defined in: types.ts:199
consent?
optionalconsent:ConsentOptions
Defined in: types.ts:204
Custom consent options for GDPR compliance
navigationSource?
optionalnavigationSource:NavigationSource
Defined in: types.ts:206
performance?
optionalperformance:PerformanceOptions
Defined in: types.ts:207
resilience?
optionalresilience:ResilienceOptions
Defined in: types.ts:208
website?
optionalwebsite:string
Defined in: types.ts:217
Umami website ID (alternative to site alias)
Example
'9e1e6d6e-7c0e-4b0e-8f0a-5c5b5b5b5b5b'defaultProps?
optionaldefaultProps:Record<string,string>
Defined in: types.ts:224
Default properties for all events (Plausible)
domain?
optionaldomain:string
Defined in: types.ts:230
Plausible domain to track (alternative to site alias)
Example
'example.com'revenue?
optionalrevenue:object
Defined in: types.ts:235
Revenue tracking configuration (Plausible)
currency
currency:
string
trackingEnabled
trackingEnabled:
boolean
apiSecret?
optionalapiSecret:string
Defined in: types.ts:243
Custom API secret for server-side tracking Required for providers that support server-side events
customDimensions?
optionalcustomDimensions:Record<string,string>
Defined in: types.ts:250
Custom dimensions mapping Maps friendly names to GA4 dimension names
Example
{ plan_type: 'custom_dimension_1' }customMetrics?
optionalcustomMetrics:Record<string,string>
Defined in: types.ts:257
Custom metrics mapping Maps friendly names to GA4 metric names
Example
{ engagement_score: 'custom_metric_1' }debugEndpoint?
optionaldebugEndpoint:boolean
Defined in: types.ts:263
Send to GA validation endpoint (/debug/mp/collect).
Default
falsedebugMode?
optionaldebugMode:boolean
Defined in: types.ts:269
Add GA4 debug_mode=1 event param so events show in DebugView.
Default
falsemeasurementId?
optionalmeasurementId:string
Defined in: types.ts:275
Google Analytics 4 measurement ID (alternative to site alias)
Example
'G-XXXXXXXXXX'onError()?
optionalonError: (error) =>void
Defined in: types.ts:283
Custom error handler for analytics errors
Parameters
error
AnalyticsError
Returns
void
Default
console.errorurlResolver()?
optionalurlResolver: () =>string
Defined in: types.ts:288
Provide a custom way to resolve the current URL. Default derives from window.location.
Returns
string
urlTransform()?
optionalurlTransform: (url) =>string
Defined in: types.ts:293
Transform the resolved URL (e.g., strip PII tokens) before dedupe/exclusions.
Parameters
url
string
Returns
string