This page helps you to understand the types of events and how to setup a custom event.

Analyzing events helps in understanding how users interact with an application. There are four types of events in the Contlo SDK:

There are four types of events in Contlo's Web SDK:

System events

These events are fired automatically by the SDK.

  • sendWebOptInDeniedEvent: This event is fired when the user refuses to receive the web push notifications.
  • sendWebOptInDismissedEvent: This event is fired when the user dismisses the web opt-in.
  • sendWebOptInSubscribedEvent: This event is fired when the user subscribes to the web push notifications.
  • viewPage: This event is fired when the user views a page on the website.

Message events

These events are related to push notifications that are automatically sent to Contlo.

  • sendWebPushDismissedEvent: This event is fired when a web push notification is dismissed.
  • sendWebPushClickedEvent: This event is fired when a web push notification is accepted or clicked.

Custom events

These events are the user journey events that you would track across the user journey. You can send the custom events using the sendEvent() method. Refer to the code given below:

contloWebSDK.sendEvent('<event_name>', '<email_address>',' <phone no>')

You can send additional parameters in the sendEvent() method. Refer to the code below:

contloWebSDK.sendEvent('<event_name>', '<email_address>',' <phone no>',
                              {"custom_property1" : "value1"}, 
                              {"custom property2" : "value2"})

📘

If you are integrating the Contlo SDK with Angular, add the following code before the sendEvent() method:

@ts-ignore

contloWebSDK.sendEvent('<event_name>', '<email_address>',' <phone no>',
                              {"custom_property1" : "value1"}, 
                              {"custom property2" : "value2"})

Charged event

This is a special event that captures details of customer purchases, including items, categories, transaction amount, transaction ID, and information about the respective user. Recording a purchase against a user marks them as a customer in Contlo. This enables you to compare your funnel reports between customers and non-customers.

Properties

The charged event has the following properties:

ParameterTypeDescription
event_idstringUsed to map the event.
transacation_valuestringThe total transaction amount attributed to the revenue.
variant_idstringThe corresponding variant(s) ID for which the transaction is taking place.
event_typestringType of event (Charged)
currencystringCurrency code of variant prices. Follows ISO 4217:2015 format.
transaction_idstringUnique identifier of the transaction.
emailstringEmail ID of the customer
phone numberstringPhone number of the customer.
product_idstringThe corresponding product (s) ID for which the transaction is taking place.
timeLongEpoch time in milliseconds.

Sample JSON:

{
   "event_id":95962,
   "event":"order_placed",
   "email":"[email protected]",
   "phone_number":"+911234567890",
   "properties":{
      "event_type":"charged",
      "transaction_value":6600,
      "transaction_id":"pay_N0km1m5ZSVp5kd",
      "order_id":"12344abc",
      "currency":"inr",
      "total_discount":123.34,
      "shipping_price":100.00,
      "subtotal_price":200,
      "total_tax":1234.00,
      "product_ids":[
         "20998",
         "18318",
         "18312"
      ],
      "collection_ids":[
         
      ],
      "variant_ids":[
         "20998INR",
         "18318INR",
         "18312INR"
      ],
      "product_prices":[
         100,
         200,
         300
      ],
      "product_quantities":[
         2,
         1,
         1
      ]
   },
   "device_event_time":1669899600000
}

Please note the following when sending a charge event:

  • Please send 0 if there is no discount/shipping price etc. and do not send null.
  • The total price is before adding the tax and discount.
  • Ensure to keep the products updated on Contlo to avoid any mismatch of product ID mapping.
  • No. of items in the arrays for product prices and quantity should be equal.