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.
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.
Please note that POST
requests have to end with a slash. Otherwise, you will receive a 302 redirect.
Event | Query param value | Description |
---|---|---|
View product | l | Product has been viewed. |
Open | o | Widget has been opened. |
Gender selected | g | Gender has been selected. |
Basic questions answered | b | Basic questions have been answered. |
Body shape selected | s | Body shape has been selected. |
Fit viewed | f | Size recommendation has been viewed. |
Adjust measurements | m | Measurements have been adjusted. |
Closed | c | Widget has been closed. |
View recommendation | vr | Recommendation has been viewed. |
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.
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.