The Event Collection API enables you to integrate user event collection capabilities into Eureka. The Event Collection API captures a wide range of user events, including searches, clicks, add-to-cart actions, and purchases. The data collected through the API supports continuous improvement of Eureka’s performance and user experience.
All collected events can be viewed and analyzed on the Analytics page of your panel, enabling deeper insights into user behavior and system effectiveness.
To get started with the API, you need an authentication token, partnerId, and locale accessible from Inone settings. After you receive an API key, you can use it to authenticate your requests.
Endpoint and Headers
Visit our Postman collection to test this request.
| Headers | Sample Value | Description |
|---|---|---|
| X-AUTH-TOKEN | INS.************************ | This key is required to authorize your request. Refer to API Authentication Tokens to generate your Event Collection API token. This token is valid for all Eureka components, such as search. |
| X-PARTNER-CONFIG-KEY | 10000001-en_GB | This is the concatenation of your partner ID and locale. |
Request Payload
The configuration for event payloads requires specific settings. On the corresponding page, you can find detailed information for each type of payload, such as search, product click, add to cart, and purchase events.
The product fields should be sent as parameters with their field name and data type as stated. The respective event is not inserted if any required fields are not sent through the Event API.
Response
| Parameter | Definition |
|---|---|
| status | It is the field that shows the result of the search. Possible values: - Success: Event is successfully collected. - Error: Unexpected internal server errors. - Invalid: Event Collection API returns a Validation Exception, meaning the request is invalid. |
| error | When there is an exception thrown (HTTP 5XX), this field is filled with code and message details. |
| validations | When the request is incorrect (HTTP 4XX), this field is filled with an array of type and message details. |
Validations
While using the Event Collection API, you might come across two types of exceptions:
- AuthException
- ValidationException
You are expected to adjust the request according to the information provided in the exception message.
AuthException
AuthException signifies an exceptional scenario occurring during API utilization, indicating that the x-auth-token parameter in the request header does not match the token provided in the Insider One's InOne panel.
Sample Response
{
"status": "AuthException",
"code": 403,
"message": "Partner token authentication is unsuccessful.",
"validations": null
}Validation Exception
Validation Exception signifies an exceptional scenario occurring when the event payload or header is not as expected. The Event Collection API requires the x-partner-config-key parameter in the request header, and it must match your partner ID.
Event-related validation details for each event are provided on the relevant event page, such as search, product click, add to cart, and purchase. Below, these validations, along with explanations, help you understand their functionality:
- required: The field must be provided.
- required unless no result: It should be provided unless the situation is "no result."
- date time: The field value format must be ISO 8601 (YYYY-MM-DDTHH:MM:SS.sss+UTC, sample value: 2023-09-27T14:40:35.967+03:00)
- past date: The date time field should not indicate a future date.
- url: The field value should be a URL string format.
- one of: The field can have only one of the indicated values.
- min: The field value must be greater than or equal to the given threshold.
- max: The field value must be lower than or equal to the given threshold.
Sample Response
{
"status": "ValidationException",
"code": 400,
"message": "Validation Error Occurred",
"validations": [
"Event type is required"
]
}Limitations
- All functions must be executed with a simple HTTPS POST request.
- Only new data can be sent via this API. No data can be retrieved.
- PartnerConfigKey should be added to the request header.