Skip to main content

Autocapture on the Web

The JavaScript, React, and Angular SDKs support autocapture, which automatically captures events and their attributes without requiring you to manually instrument your code.

Attributes Captured

Common Metadata (on all events)

Statsig automatically captures comprehensive metadata with each autocapture event to provide rich context for analysis:

  • To filter events, you can use the eventFilterFunc option when initializing the Statsig client.
  • To sanitize events and its metadata, you can use listen for the pre_logs_flushed client event and modify the event object before it is sent to Statsig. (See Client Event Emitter for more details.)

Page and Environment Metadata:

PropertyDescription
metadata.titlePage title from <title> tag
metadata.current_urlFull current URL
metadata.hostnameDomain name of the current page
metadata.pathnamePath portion of the URL
metadata.user_agentBrowser user agent string (truncated to 200 chars)
metadata.localeBrowser language setting
metadata.timezoneUser's timezone
metadata.timezone_offsetTimezone offset in minutes
metadata.timestampEvent timestamp in milliseconds

Screen and Viewport Data:

PropertyDescription
metadata.screen_widthScreen width in pixels
metadata.screen_heightScreen height in pixels
metadata.viewport_widthBrowser viewport width in pixels
metadata.viewport_heightBrowser viewport height in pixels

Network Information:

PropertyDescription
metadata.effective_connection_typeConnection speed estimate
metadata.rtt_msRound-trip time in milliseconds
metadata.downlink_mbpsDownload speed in Mbps
metadata.save_dataWhether user has data saver enabled

Referrer and Traffic Source Data:

PropertyDescription
metadata.referrerFull referrer URL
metadata.referrer_domainDomain of the referrer
metadata.referrer_pathPath of the referrer URL
metadata.searchEngineDetected search engine
metadata.searchQuerySearch query from referrer

Campaign and Marketing Attribution:

Statsig automatically captures 25+ marketing attribution parameters including:

PropertyDescription
metadata.utm_sourceUTM source parameter
metadata.utm_mediumUTM medium parameter
metadata.utm_campaignUTM campaign parameter
metadata.utm_termUTM term parameter
metadata.utm_contentUTM content parameter
metadata.utm_idUTM ID parameter
metadata.gclidGoogle Click ID
metadata.fbclidFacebook Click ID
metadata.msclkidMicrosoft Bing Click ID
metadata.ttclidTikTok Click ID
metadata.li_fat_idLinkedIn Click ID
metadata.epikPinterest Click ID

Additional Platform IDs Captured:

  • gclsrc, wbraid, gad_source (Google)
  • dclid (DoubleClick)
  • irclid (Impact)
  • igshid (Instagram)
  • _kx (Klaviyo)
  • mc_cid, mc_eid (Mailchimp)
  • qclid (Quora)
  • rdt_cid (Reddit)
  • sccid (Snapchat)
  • ttc, ttc_id (TikTok)
  • twclid (Twitter)

Action Events (Click, Form Submit, etc.)

PropertyDescription
tagNameThe HTML tag of the clicked element
classListThe list of CSS classes on the clicked element
classThe class attribute of the clicked element
idThe ID attribute of the clicked element
ariaLabelThe aria-label attribute of the clicked element
selectorA CSS selector that uniquely identifies the clicked element

depending on the event element, the following properties may be captured:

  • action
  • method
  • formName
  • formId
  • href
  • content
  • inputName
  • textContent
  • selectedText ...and more

Page View Events

PageViewStart:

PropertyDescription
last_page_view_urlThe URL of the last page view

PageViewEnd:

PropertyDescription
page_view_lengthThe length of the page view in milliseconds
lastScrollYThe last scroll position in pixels
maxScrollYThe maximum scroll position reached during the page view in pixels
lastScrollPercentageThe last scroll percentage (0-100) of the page
maxScrollPercentageThe maximum scroll percentage reached during the page view (0-100)
scrollDepthThe scroll depth percentage (0-100) - deprecated, use maxScrollPercentage instead
dueToInactivityWhether the page view ended due to inactivity

Dead Click Events

PropertyDescription
scrollTimeoutBoolean indicating if a scroll timeout occurred
selectionChangeTimeoutBoolean indicating if a selection change timeout occurred
mutationTimeoutBoolean indicating if a mutation timeout occurred
absoluteTimeoutBoolean indicating if an absolute timeout occurred
scrollDelayMsThe number of milliseconds to wait before considering a scroll event as a dead click
selectionChangeDelayMsThe number of milliseconds to wait before considering a selection change event as a dead click
mutationDelayMsThe number of milliseconds to wait before considering a mutation event as a dead click
absoluteDelayMsThe number of milliseconds to wait before considering an absolute timeout event as a dead click

Rage Click Events

PropertyDescription
xThe x-coordinate of the rage click
yThe y-coordinate of the rage click
timestampThe timestamp of the rage click in milliseconds

Web Vitals Events

PropertyDescription
nameThe name of the web vital ('CLS', 'FCP', 'LCP', 'TTFB')
valueThe current measurement value (e.g., milliseconds for LCP, FCP, etc.; a numeric score for CLS)
deltaThe change from the previously reported value—used to calculate cumulative values over time
idThe ID of the web vital event

Console Log Events

PropertyDescription
statusThe status of the console log ('debug', 'info', 'warn', 'error')
log_levelThe level of the console log ('debug', 'info', 'log', 'warn', 'error')
payloadThe payload of the console log (array of strings)
timestampThe timestamp of the console log in milliseconds (epoch time)
traceA stack trace (if available) showing where in the code the console log was triggered (array of strings)
sourceThe source of the console log ('js-auto-capture')

Query Parameters:

All URL query parameters are automatically captured as individual metadata fields with their parameter names as keys.