Pushing an Event
If you need to track custom events, call the following snippet after listening to theexp-analytics-loaded event:
-
event_nameA unique string identifier for your event (e.g."product_clicked","checkout_started"). -
countHow many times this event should be counted (often1for discrete actions). -
sumA numeric value to aggregate—useful for revenue, scores, or any measurable metric. -
durDuration in seconds—track time‑on‑task, video playtime, or other time‑based metrics. -
event_dataAn object of custom dimensions or attributes (strings, numbers, or arrays). For example:
Example: Tracking a Button Click
purchase_initiated event, increments its count by 1, adds the purchase amount to your sum metric, and attaches product details via segmentation.
Once you’ve got custom events flowing, you can review them in the Experro Analytics dashboard or proceed to the next section to see our built‑in E‑Commerce and Auth event keys and their expected payloads.