Track events

Utilize the PLuG SDK for effective tracking of user interactions. This feature enables you to transmit customized events, defining how users engage with your product or website. Analyze these events to gain insights into product usage metrics, to deploy targeted campaigns, and to equip your customer experience team with precise information about customer interactions.

How to track user events using PLuG

To track user events through PLuG, employ the trackEvent method provided by the PLuG SDK, which automatically associates the event with the currently active user profile within the widget. To learn more about user identification in the PLuG widget, see Identify your users with PLuG.

window.plugSDK.trackEvent(event_name, properties)

Event name: Specify a meaningful name for the custom event, for example, added_to_cart, made_payment, or subscribed. Use alphanumeric symbols, underscores (_), or hyphens (-) in the event name.

Properties (optional): Object containing metadata with additional context and information related to the captured event.

DevRev doesn’t recommend setting certain fields in the payload, such as devrev_source_identifier (event source), plugSessionId (UUID for tracking sessions), and is_devrev_internal_event (event auto-tracked by PLuG).

// Sample code for the trackEvent method:
var properties = {
"name" : "John Doe",
"plan" : "Starter",
"payment_method" : "Credit Card",
"expiry_date" : "2024-12-12"
}
window.plugSDK.trackEvent("signed_up",properties)

PLuG user context: For each shared event, PLuG automatically includes user context properties. These properties encompass details such as event time, user browser information, locale, device specifications, timezone, operating system version, and the page URL from which the event originated.

Viewing user events: Go to the user profile and click the Usage tab. This data is refreshed every 24 hours. Events can also be viewed directly within user sessions, where the data is updated instantaneously.