Skip to content

Configuration reference ​

Browser initialization ​

OptionTypeDefaultPurpose
appstringrequiredStable application identity
releasestringinjected when availableRelease used by comparisons and maps
commitstringinjected when availableSource and build identity
buildTimestampstringinjected when availableBuild metadata
environmentstringinjected Vite modeEnvironment selector
sampleRatenumber1Session inclusion probability from 0 to 1
transportTransportHTTP transportCustom delivery implementation
endpointstring/__tracelensHTTP collector URL
flushIntervalnumber1000Flush interval in milliseconds
batchSizenumber20Maximum events per delivered batch
privacyPrivacyOptionsrestrictive defaultsURL and element policy
tracePropagationTracePropagationOptionsdisabledOpt-in traceparent propagation

Explicit initialization values override Vite-injected metadata.

Privacy ​

ts
privacy: {
  queryParameters: 'allowlist',
  allowedElementAttributes: ['data-tracelens-name', 'role', 'type'],
  url: {
    stripQuery: false,
    allowedQueryParameters: ['page'],
    redactSegments: ['users', 'accounts'],
    sanitize(url) {
      return url.replace(/\/orders\/[^/]+/, '/orders/[redacted]');
    },
  },
}

Input values, DOM text, request bodies, and headers are never collected. Query values are dropped unless both queryParameters: 'allowlist' and stripQuery: false are set.

Trace propagation ​

ts
tracePropagation: {
  allowedOrigins: ['https://api.example.com'],
}

Trace propagation is off by default. Headers are added only to allowed HTTP(S) origins and never to the TraceLens collector request.

Vite metadata ​

ts
tracelens({
  release: '1.0.0',
  commit: '7ac841f',
  environment: 'production',
});

Without explicit values, the plugin reads the nearest package version, the current Git commit, the build time, and the Vite mode.

Performance budgets ​

yaml
minimumSamples: 20
performance:
  inp:
    p75: 200
  lcp:
    p75: 2500
  cls:
    p75: 0.1
  longFramesPerSession:
    max: 1
routes:
  /checkout:
    inp:
      p75: 150

Unknown keys and duplicate YAML keys fail closed. Every configured check must meet minimumSamples.

Released under the MIT License.