Event Integration, also known as custom event tracking or sending your own JavaScript events to Insider One, lets developers send user-defined events to Insider One using the Insider.track() JavaScript function. Each call accepts an event name, an event timestamp, and event parameters, both default and custom, making it the standard method for tracking interactions that fall outside the default event schema, such as form submissions or filter clicks.
For Custom Event Parameters, use a custom object in the event parameter of the object, as shown in the example below. When this event is called, Insider One's JavaScript (ins.js) will send that event to our database.
Each event parameter should have a different name.
For Predefined Event Parameters, refer to the Predefined Event Parameters table below.
Most standard events (cart page view, purchase) are processed using the Insider Web SDK Integration method. You can use the Event Integration method for most other user events.
This guide explains the following concepts:
Sample code
The following sample code displays Predefined Event Parameters for the event event-name-1 and a Custom Event Parameter for the event event-name-2.
You should trigger this function after the Insider Tag (ins.js) loads so that ins.js can reach the data.
Insider.track('events', [{
"event_name": "event-name-1",
"timestamp": "2020-07-13T21:35:20Z",
"event_params": {
"product_id": "AGH210070",
"taxonomy": [
"Electronic",
"Phone"
],
"currency": "USD"
}
},
{
"event_name": "event-name-2",
"timestamp": "2020-07-13T21:35:20Z",
"event_params": {
"unit_price": 890,
"custom": {
"car_brand": "BMW"
}
}
}
]);Predefined event parameters
The table below lists the predefined event parameters.
Event Parameter Name | Definition | Type |
|---|---|---|
product_id | Product ID | String |
name | Product Name | String |
taxonomy | Product Categories | Array |
currency | Currency | String |
unit_price | Product Price | Float |
unit_sale_price | Discounted Product Price | Float |
color | Color attribute of the product | String |
size | Size attribute of the product | String |
stock | Stock information of the product | Number |
product_image_url | Product Image URL | String |
session_id | Session ID | String |
event_group_id | Event Group ID (like transaction ID or cart ID) | String |
Validations
The list below explains the validations for sending events.
Event time should be provided in a timestamp field, in RFC3339 format, on the same level as event_name and event_params. If not, the current time will be set as the default.
event_name keys should start with a letter or a number. Only lowercase letters, numbers, underscores, and dashes are allowed. Regex is as follows: ^[a-z0-9][a-z0-9_-]*$
event_params keys should start with a letter. Only lowercase letters, numbers, and underscores are allowed. Regex is as follows: ^[a-z][a-z0-9_]*$