Salla’s standard event tracking covers core e-commerce flows, but you can define custom events to handle everything else. Whether you need to monitor custom widget interactions, track unique user journeys, or log specific app behaviors, you can push customized payloads directly into the analytics pipeline from either the frontend or backend.
The name of your custom event (e.g., "Promotion Viewed").
properties
object
Key-value pairs containing the event payload.
Scenario: Tracking Promotions and Rewards
Here is how you would track a user viewing a seasonal promotion and subsequently claiming a loyalty reward. Always ensure you wrap your tracking calls inside Salla.onReady() so the analytics module is fully loaded.
Every event emitted by Salla automatically includes a context object containing environment data (browser, device, page, campaign). You can extend this context with custom properties, such as an A/B test variant or loyalty tier, using one of the following methods.
Use setAppContext to define context properties that will automatically attach to all subsequent events fired by your app or theme. The appId ensures isolation, preventing your context from overwriting data from other apps.
Scoped context is ideal for components like Quick Add widgets, where a single user action might trigger multiple events, but you do not want the contextual data persisting into the broader, site-wide event stream.Use withAppScope to attach context exclusively within a specific code block. Once the block executes, the context is automatically stripped, preventing data leaks into unrelated events.