Add a Custom Action¶
addAction(name, context?) is used to actively record business operations that cannot be expressed through page clicks, such as payment success, search submission, or feature toggle changes.
For automatic click collection and action naming, refer to Tracking User Actions.
Parameters¶
| Parameter | Type | Required | Description |
|---|---|---|---|
name |
String | Yes | A stable business operation name, for example checkout_completed |
context |
Object | No | Business fields for this operation, for example amount, channel, or result |
Action names should remain stable. Dynamic values such as order IDs and user IDs should be placed in context, not concatenated into the name.
NPM Example¶
import { datafluxRum } from "@truewatchtech/browser-rum"
datafluxRum.addAction("checkout_completed", {
order_value: 42,
payment_method: "card"
})
CDN Example¶
Verification¶
After triggering the business operation, search for checkout_completed in the Action Explorer of the corresponding web application, and confirm that the action name and custom fields have been written to the event.