Automatic Event Capture
Once installed on your customer’s site, Radar automatically captures$pageview events. You can enable more advanced automatic event tracking by setting the appropriate feature flags in your configuration.
Page Tracking (Enabled by Default)
$pageview: Fired every time a page is loaded or the URL hash changes. Includes details like the page URL, title, and referrer. When a user navigates away from a page, Radar captures engagement data (total time on page and engaged time) and includes it in the event as$total_time_on_pageand$engaged_time_on_pageproperties.
Form Tracking (features.formTracking)
When you enable formTracking, Radar will automatically capture the following events on your customers’ websites:
$form_start: Fired when a user first interacts with a form field (e.g., focus or input). Includes the form’s ID.$form_submit: Fired when a user successfully submits a form. The event includes the form’s name, ID, and all non-sensitive field values.$form_abandon: Fired when a user interacts with a form’s fields but navigates away from the page without submitting.
Radar automatically redacts data from fields that appear to be sensitive (e.g., fields with names like
password, credit_card, ssn).Click & Download Tracking (features.clickTracking, features.downloadTracking)
- Click Tracking: When you enable
clickTracking, Radar automatically captures clicks on<a>and<button>elements, as well as any element with adata-track-eventattribute on your customer’s site. Each click event includes the element’s text, href, CSS classes, DOM path, data attributes, and parent element info. - Download Tracking: When you enable
downloadTracking, Radar will fire a$downloadevent when a user clicks a link that points to a common file type. Supported extensions include documents (.pdf,.docx,.xlsx,.csv,.pptx), archives (.zip,.rar,.7z,.tar,.gz), media (.mp4,.mp3,.mov,.wav), and design files (.psd,.ai,.sketch,.fig). The event includes the file name and link href.
Tracking Custom Events
For actions specific to your customers’ applications, you can provide documentation and examples showing them how to send custom events using thetrack method, which is exposed by the namespace you defined in the loader script.
Adding Event Properties
You should instruct your customers on how they can enrich custom events with metadata by passing a second argument containing a JSON object. This is essential for capturing the full context of an action.event_properties object of the webhook payload you receive. See an example in Receiving Events.