On this page

Track events with PLuG

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.

icon

This functionality is currently in beta.

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.

1 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.

icon

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).

1 // Sample code for the trackEvent method:
2 var properties = {
3 "name" : "John Doe",
4 "plan" : "Starter",
5 "payment_method" : "Credit Card",
6 "expiry_date" : "2024-12-12"
7 }
8 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: To review all events performed by a user, navigate to the user profile within your DevRev app and click on the "Usage" tab. The events displayed in the user profile are updated every 24 hours.