Events JavaScript API

Last updated June 17, 2020

_hsq.push(["trackEvent", { {event details} }]);

Please note: Events will only be processed for accounts with Marketing Hub Enterprise.

Use this endpoint to track an event using JavaScript and HubSpot's tracking code. You can use events to track specific activities completed by visitors on your site. Tracked events can show up in contacts' timelines.

Use case for this endpoint: Events can capture actions like logging in. You can use data from this endpoint to segment users how have not logged in in more than seven days and target them with a re-engagement campaign.

Arguments How to use Description
Event ID id: The ID of the event. If you created the event in HubSpot, use the generated ID of the event as a string. Otherwise, you can use a string name for the event to dynamically create an event. See the overview for more details on names and ids.
Value value: The value of the event. This is an optional argument that can be used to track the revenue of an event. This value will be used to increment the hs_analytics_revenue property if the event is associated with a contact record.