Automatic Event Capture
Once installed on your customer’s site, Radar automatically captures$pageview
and $pageleave
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.$pageleave
: Fired when a user navigates away from a page. This event is used to calculate time-on-page metrics in session-based delivery.
Form Tracking (features.formTracking
)
When you enable formTracking
, Radar will automatically capture the following events on your customers’ websites:
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-event
attribute on your customer’s site. - Download Tracking: When you enable
downloadTracking
, Radar will fire adownload
event when a user clicks a link that points to a common file type (e.g.,.pdf
,.docx
,.zip
).
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.
Advise your customers to use a consistent
[Object] [Verb]
naming convention to keep their events organized and readable. For example: File Downloaded
, User Upgraded
, or Video Played
.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.