Track Events
4 min
track custom events to understand user behavior, trigger appstorys campaigns, and create audience segments based on user interactions call appstorys trackevent() whenever a user performs an action you want to measure, such as completing a purchase, clicking a button, or adding an item to the cart await appstorys trackevent('event name'); track an event with metadata attach additional information to an event this data can be used for campaign targeting, audience segmentation, and analytics await appstorys trackevent('event name', undefined,{ category 'shopping', }); attribute an event to a campaign (optional) to associate the event with one specific campaign, provide its campaign id as the second parameter await appstorys trackevent('event name', 'campaign id', { category 'shopping', }); back button & exit intent campaign triggers this works automatically once the sdk is initialized — no extra integration code is required the sdk listens for the web equivalents of a "back" action (the mouse leaving the top of the viewport and the browser's back button), so campaigns configured to trigger on exit intent become eligible without any code on your side