Track Custom Events

Track custom actions that your users perform

If you use an analytics tool, you likely track custom events to measure your users' in-app behavior. Use the Custom Events API to make these events accessible in LogRocket.

SDK.track(new CustomEventBuilder("Registered"));

You can then search for sessions containing these events using a Custom Event filter in the LogRocket Dashboard:

240240

You can optionally provide additional properties that will be associated with the event:

SDK.track(new CustomEventBuilder("PurchaseComplete") {{
  put("revenue", 24.99);
  put("productCategory", "Clothing");
  put("productSku", 488736929); // Integer values are cast to Double values automatically
  put("couponApplied", true);
  put("customerSegments", "aef34b", "97cb20"); // Multiple values can be added in one call
}});

Properties may be of type boolean, double, or string. Arrays of primitives (boolean, double, or string) are also supported.

There are a few limits to keep in mind when providing properties to Custom Events:

  • Property names must be under 100 characters.
  • A maximum of 500 properties may be uploaded per session. Properties over this limit will not be recorded.

📘

'Revenue' Property

The 'revenue' property is a special property that you can use to pass data into our funnels. For more information, see here.