Skip to main content

Track Events

For situations in which Auto Events are insufficient alone to track visitor activity or when your application needs to send additional events to describe that activity, Agent 2.14.3+ includes pendo.track(name, metadata?) that your application can invoke to send synthetic events. These are collected in the same manner as regular events, automatically recording the time and URL at which the event was triggered. Each Track Event requires a trackType that uniquely identifies it during event processing, analogous to the click or focus types of Auto Events. Additional metadata about the event must be supplied in the function call. You can view the different trackType values and associated analytics that have been processed on the Track Events list.

Since the Pendo Agent automatically collects Auto Events, you only need to use Track Events judiciously to track side-effects of user interactions, like creating or deleting a record, or for logging a specific error case for monitoring purposes. Track Events can transmit any arbitrary data in their metadata payload, even different payloads for the same Track Type. This metadata will be available in the timeline charts in Pendo for inspection and can be queried using the Aggregation API.

See our Track Events guide in the Pendo Help Center for more.

Track Event Example

// Side-effect of user interaction: recording membership level
User.registerViaFacebook(payload)
.then(doStuffAfterRegistering)
.catch(handleRejection)
.finally(user => {
pendo.track("User Registered", {
userId: user.id,
plan: user.plan,
accountType: "Facebook"
});
});

// Monitoring an interesting error case
try {
this.thing.thatBreaks(sometimes);
} catch (error) {
pendo.track("JIRA-12345--error-tripped", {
message: error.message,
stack: error.stack
});
handleThrown(error);
}