What are custom events

enKod allows you to track a variety of events on your website or application. Among them: product or page views, changes to baskets, favourites, orders and order returns. At some point, you may need to customise the mechanics based on a specific event that we haven't provided.

In this case, you can create a custom event, and based on it:

  • segment the base
  • send messages
  • run scenarios

A custom event is an HTTP API request or a JS script method that you create in the service, call it in a way convenient for you and transmit it to us from your website, from an internal service, a mobile application and any necessary system. Inside a custom event, you can pass a set of parameters, which can also be used for segmentation. Event parameters will be created automatically if they were not created previously.

An event must always be assigned to a contact. Whichever transmission method you choose, transmission of the contact ID inside the event is required.

Event creation and parameters

Events are created in the DataEvents.

An event must be created in the service before it is transmitted. Otherwise we will not record it. At the same time, it is not necessary to create parameters beforehand, we will create them automatically. You will only have to add names for them later.

Note that the value of a parameter when it is passed must match the data type of the parameter when it was created (including if the parameter was created automatically). Parameter values will not be written to enKod if their data type does not match the declared one.

For example, if you pass a value of type “date” (2012-12-12 10:33) for the parameter “date” during the first event pass, a parameter with type “date” will be created in the interface. When you subsequently pass a value of type “string” (“some_value”) to this parameter, it will not be written to the event log and contact card because of data type conflict (because the parameter was originally created with data type “date”).

Transmission of custom events

Note that a custom event must be bound to a contact that already exists in the enKod base. If a new contact is transferred, the event will not be recorded in the history. Before passing a custom event, you must add the contact to the service (by any method: for example, via API or script method), if it has not been done before.

API

Use the POST /customEvent/save method to send us the event.

To mass import custom events use method POST /customEvent/save/bulk/. Note the limitations:

  • maximum 1000 events in one request;
  • the event must be created in advance in enKod;
  • a scenario with start on custom event will not be run for events passed by this method.

To check the status of this import, use method GET /customEvent/status/{guid}/. Obtaining the import status is available only within 24h from the moment of creating a task to import events.

Script

ekEvents.push('event', {email:'[email protected]', phone:'79000000000', params: {param1: 'value1'}});

where:

  • event is the system name of the event created in the Data ➔ Custom events
  • param - system name of parameter
  • value - value of the parameter

The method may (optionally) include the contact’s email and/or phone number. If the email and/or phone number are not transmitted or contacts with such identifiers are not found in the account, then we will associate the event with the session if we know it. If linked to a session and if it is not present (and there is no email or phone number transferred to your account), the event will not be displayed in enKod.

Custom events and session

You can create sessions to contacts using script or using the API method. These sessions can be used to handle custom events.

Custom events sent without email or phone number will not be recorded in the interface, but we will still store them in the database. At some point, a contact may authorize on the site, and we can associate the session (which is already stored) with the identifier (which the contact used when authorizing). In this case, we will load all the events of this contact into the event history (and populate his card with the events he performed before authorization).

Event log

In the same section Data ➔ Events in the “Event History” tab, you can view the entire history of custom events that you have sent to us over time. Using history, you can search for the events themselves, as well as the contacts that were transferred to them.

By clicking on the event name, details will be displayed - parameters and values that were created.

Segmentation by custom events

Segmentation by custom events with subconditions on event parameters is available for all parameter data types: string, date, date-time, number, fractional and logical.

Start scenario when receiving a custom event

In scenarios, you can set up the initial “Custom Event” block by specifying restrictions on the parameter values ​​of this event, if necessary. In this case, when the specified event is received, the scenario will be launched for the user specified in the request.

Last modified: 2025.04.08 15:06 by Elizaveta Ivannikova