Conversions
Krestor is unique in that it is designed to optimize for business KPIs. Most commonly this means optimizing revenue-per-visitor and/or purchase conversion rate. .
In addition to purchase conversion events, Krestor allows customers to communicate a wide array of additional success events that may happen independently from purchase (for instance reading a recipe) or may happen as an event preceding purchase (adding to cart or messaging a seller in a marketplace). These success indicators can be used to train Krestor's model and in future will be shown in the dashboard to differentiate from likes, messages and add to carts in the dashboard interface, as an example.
These extended success metrics are tracked via the generic conversion endpoint, documented below. Purchase conversions are tracked in collaboration with the Krestor client integration team using a separate endpoint.
Examples of events tracked with the generic conversion endpoint include:
- Add to cart
- Add to wishlist
- Like
- Send a message
- Make an offer
- Read
Log a conversion event
To capture the diversity of use cases our customer base, we allow several different types of conversion to be communicated, and also allow logging of entirely custom conversion types.
To log a conversion event, simply specify the necessary conversion type and other required fields (documented below) while making a POST
request to:
POST https://ac.cnstrc.com/v2/behavioral_action/conversion
Requests have to also include query string parameters and body of the request has to have JSON object with the necessary fields documented below.
- Shell
- JavaScript
- Python
- Java
- iOS
- Android
- C#
curl -X POST -H 'Content-Type: application/json' \
-u '[your token]:' \
"https://ac.cnstrc.com/v2/behavioral_action/conversion? \
section=<section used> \
&key=<your API key> \
&c=<client id> \
&i=<user id> \
&s=<session number>" \
-d '{
"item_id": "brown_toy_poodle",
"search_term": "toy poodle",
"type": "add_to_cart"
}'
// This method is not currently supported.
# This method is not currently supported.
// This method is not currently supported.
// This method is not currently supported.
// This method is not currently supported.
// This method is not currently supported.
info
The above command returns a 204 Success response on success.
Query String Parameters
Parameter | Type | Required? | Description |
---|---|---|---|
key | string | Yes | The key of the index you'd like to log events for. |
c | string | Yes | Client id. The library responsible for making the request |
i | string | Yes | User's device id. An anonymized user identification hash. |
s | integer | Yes | Session number. The counter for the session in which the behavior event occurred. We recommend to increment the session number every 30 minutes |
ui | string | No | Your internal ID for a user (if available) |
_dt | integer | No | Unix timestamp in seconds of when the event happened |
us | array of strings | No | User segment |
section | string | No | Your autosuggest and search results can have multiple sections like "Products" and "Search Suggestions". This indicates which section was searched. See your dashboard for the section names to use. |
origin_referrer | string | No | The url where the event originated. |
JSON Parameters
Parameter | Type | Required? | Description |
---|---|---|---|
type | string | No | Type of conversion event (see options below). This defaults to add_to_cart if type is not specified in the request body. |
display_name | string | No | Display name for the conversion event. This display name will be shown on the dashboard in the future to clarify usage. It is required if the conversion event is custom (i.e. is_custom_type is set to true). |
search_term | string | No | Search term associated with this conversion event. |
is_custom_type | boolean | No | Specifies if the conversion type is a custom type event. This field needs to be set to true if you'd like to use custom event types. |
Default types and display names
If the conversion type is standard and display_name
is not specified in the request body, default display names will be used.
The mapping for standard conversion type
to default display_name
is as follows:
type | display_name |
---|---|
add_to_cart | Add to cart |
add_to_wishlist | Add to wishlist |
like | Like |
message | Send a message |
make_offer | Make an offer |
read | Read |
Overriding these display names allows customers to reflect the language within their app or website more consistently - for instance if the UX in an app is "Add to basket" rather than add to cart, or "Ask seller a question" rather than "Send a message"
Custom Conversion events
To use custom conversion events, specify "is_custom_type": True
in the request body, then set a display_name
and specify the type
of conversion event you'd like to log.