Skip to main content

Browse

Log a browse event

To capture the diversity of use cases our customer base, we allow several different types of browse events to be communicated.

EventMeaning
browse_result_loadbrowse result page was loaded
browse_result_clickuser clicked a product on browse results page

To log an event make a POST request to:

POST https://ac.cnstrc.com/v2/behavioral_action/<event_type>

where event_type is one of browse_result_load, browse_result_click. Requests have to also include query string parameters and body of the request has to have JSON object with the necessary fields, depending on event type (documented below).

Example

Log an event
curl -X POST -H 'Content-Type: application/json' \
-u '[your token]:' \
"https://ac.cnstrc.com/v2/behavioral_action/browse_result_load? \
section=<section used> \
&key=<your API key> \
&c=<client id> \
&i=<user id> \
&s=<session number>" \
-d '{
"url": "https://example.com/browse",
"filter_name": "brand",
"filter_value": "the-brand"
}'
info

The above command returns a 204 Success response on success.

Query String Parameters

ParameterTypeRequired?Description
keystringYesThe key of the index you'd like to log events for.
cstringYesClient id. The library responsible for making the request
istringYesUser's device id. An anonymized user identification hash.
sintegerYesSession number. The counter for the session in which the behavior event occurred. We recommend to increment the session number every 30 minutes
uistringNoYour internal ID for a user (if available)
_dtintegerNoUnix timestamp in seconds of when the event happened
usarray of stringsNoUser segment
sectionstringNoYour 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_referrerstringNoThe url where the event originated.

JSON Parameters

Browse result load

ParameterTypeRequired?Description
urlstringYesURL of the browse results page
result_countintegerNoTotal number of results
result_pageintegerNoCurrent page of results
result_idstringNoresult_id returned by Krestor browse response
itemsarray of objectsNoItems that were loaded. Up to 100 items, each object has to include either item_id or item_name keys, and optionally can include variation_id. All values are strings.
selected_filtersobjectNoFilters that the user had selected on the browse results page. Object with string keys and values
sort_bystringNoThe field that the user had sorted by
sort_orderstringNoThe order of sorting. One of descending or ascending
filter_namestringYesThe name of the browse filter
filter_valuestringYesThe value of the browse filter

Browse result click

ParameterTypeRequired?Description
item_idstringNoID of the item that was clicked (either it or item_name is required)
item_namestringNoName of the item that was clicked (either it or item_id is required)
variation_idstringNoID of the variation that was shown to the user when the result was clicked
result_countintegerNoTotal number of results
result_pageintegerNoCurrent page of results
result_idstringNoresult_id returned by Krestor browse response
itemsarray of objectsNoItems that were loaded. Up to 100 items, each object has to include either item_id or item_name keys, and optionally can include variation_id. All values are strings.
selected_filtersobjectNoFilters that the user had selected on the results page. Object with string keys and values
sort_bystringNoThe field that the user had sorted by
sort_orderstringNoThe order of sorting. One of descending or ascending
filter_namestringYesThe name of the browse filter
filter_valuestringYesThe value of the browse filter
result_idstringNoresult_id returned by Krestor browse response
result_position_on_pageintegerNoPosition of the result that was clicked relative to the current page
num_results_per_pageintegerNoNumber of results on the current page
selected_filtersobjectNoFilters that the user had selected on the browse results page. Object with string keys and values