Skip to main content
Version: 1.0

Tracking integration

Overview

Tracking starts with getting and storing a device ID. This ID is used to identify the device when sending tracking events to Robosize.

Get the device ID

If you are using the Robosize widget, this ID is automatically generated by the widget and is available at window.Robosize.deviceId. Otherwise, you need to generate this ID yourself. In order to receive an ID for your device, you need to send a GET request to the following endpoint:

https://api.robosize.com/api/v1/widget/get-id/?business=DOMAIN

where DOMAIN is the domain of your store.

Domain for apps

If you are integrating your mobile app, you can use the domain of your website or request a domain for your app in order to separate events for the app.

The response will be a JSON object with the following structure:

{
"id": "DEVICE_ID"
}

Provide device ID in the subsequent API calls

You need to store the device ID in order to use it in the subsequent API calls. In each subsequent call you have to provide the device ID as a query parameter even for POST requests.

https://api.robosize.com/api/v1/widget/.../?business=DOMAIN&rs_id=DEVICE_ID

Track events

In order to track events, you need to send a POST request to the following endpoint:

https://api.robosize.com/api/v1/widget/analytics/record/?event={{EVNET}}&product=PRODUCT_ID&business=DOMAIN&rs_id=DEVICE_ID

where DOMAIN is the domain of your store and DEVICE_ID is the device ID that you received in the previous step and the PRODUCT_ID is the ID of the product that the event is related to. And the EVENT is the name of the event that you want to track from the following table.

Ending slash

Please note that POST requests have to end with a slash. Otherwise, you will receive a 302 redirect.

EventQuery param valueDescription
View productlProduct has been viewed.
OpenoWidget has been opened.
Gender selectedgGender has been selected.
Basic questions answeredbBasic questions have been answered.
Body shape selectedsBody shape has been selected.
Fit viewedfSize recommendation has been viewed.
Adjust measurementsmMeasurements have been adjusted.
ClosedcWidget has been closed.
View recommendationvrRecommendation has been viewed.
Adjust measurements

Sometimes the recommender cannot find a good size for the user. In these cases, the recommender will return a response like the following:

{
"status": 400,
"data": {
"message": "Could not find a good size of this product"
}
}

You can use the status code in the body of the response to detect this case and ask the user to enter their measurements. Once the user enters their measurements, you can send the Adjust measurements event to Robosize.

View recommendation

The View recommendation event is sent when the user receives a recommendation without having to open the widget. Once the user enters the answers to the widget questions, you can store the information and provide the recommendation automatically.