Direct to API tracking
WarningConstructor API endpoints are subject to change. Implementing tracking directly against the API instead of utilizing a client library may result in upkeep to keep tracking healthy and up to date with evolving specifications. Our recommended approach to tracking is Data-driven Event Tracking.
Constructor’s advanced machine learning and AI algorithms are driven from data generated by your users. We collect behavioral data to deliver highly personalized, relevant results. The specific events we track are:
- Session start
- Autocomplete - input focus
- Autocomplete - submit
- Autocomplete - select
- Search - results load (PLP)
- Search - result click (PLP)
- Browse - results load (PLP)
- Browse - result click (PLP)
- Recommendations - result view
- Recommendations - result click
- Quizzes - load
- Quizzes - result click
- Quizzes - conversion (add to cart)
- Generic result click
- Item detail load (PDP)
- Conversion (add to cart)
- Purchase
Parameters for all requests
All request events should contain the data described below sent in query parameters. Events that are sent via POST should contain the below parameters within the body of the request in addition to within query parameters.
key: The index / API key to track against.i: A device ID (GUID) generated by Constructor’s tracking client (or by customers with a device ID) to uniquely identify a device in the absence of a canonical user identifier.- Web Browsers: found in the
ConstructorioID_client_idcookie. - Android App: can be accessed by calling the
getClientId()function on an instance of the client when using our Android client library. - iOS App: can be accessed through the
clientIdfield on an instance of the client when using our iOS client library.
- Web Browsers: found in the
s: An incremental integer to identify a user session. This value should increment by 1 after 30 minutes of inactivity (inspired by Universal Analytics).- Web Browsers: found in the
ConstructorioID_session_idcookie. - Android App: can be accessed by calling the
getSessionId()function on an instance of the client when using our Android client library. - iOS App: can be accessed through the
sessionIdfield on an instance of the client when using our iOS client library.
- Web Browsers: found in the
c: A unique identifier for the type of device or browser. This parameter identifies the client the request is coming from and it should have the following format:cio-[fe/be]-[platform]-[company name].[fe/be]indicates a frontend or backend integration.[platform]indicates web or mobile platform.[company name]indicates the name of the company (should correspond with company name in customer dashboard).
ui: An internal identifier (non PII) that uniquely identifies the user across devices. This parameter should only be transmitted for logged in users._dt: A Unix timestamp for when the event occurred.origin_referrer: The page or screen on which the event occurred. Accepted on all tracking events.canonical_url: The canonical URL of the page on which the event occurred. Accepted on all tracking events.document_referrer: The referring URL, where available. Accepted on all tracking events.
Session start
Session start events are sent when a new session starts.
GET https://ac.cnstrc.com/behavior?action=session_start
Autocomplete - input focus
Autocomplete input focus events are sent when the search bar receives focus. If the user leaves the search bar and returns to it, another autocomplete input focus event should be dispatched.
GET https://ac.cnstrc.com/behavior?action=focus
Autocomplete - submit
Autocomplete submit events are sent when a user submits a search (form submission).
GET https://ac.cnstrc.com/autocomplete/[term]/search?original_query=[original_query]
URL parameters
| Name | Type | Description | Required |
|---|---|---|---|
term | string | The query submitted. This will be the same value as [original_query] in the case where the user typed into the input field and submitted the form. If the user selects a term from an autocomplete suggestion, [term] will be equal to that selected term, where [original_query] would be the originally typed user input. | ✔ |
Query parameters
| Name | Type | Description | Required |
|---|---|---|---|
original_query | string | The actual text the user typed (which may be different than [term] if the user went on to select an autocomplete term suggestion). | ✔ |
result_id | string | The result_id returned from the Constructor API with the autocomplete result response, if available. | |
group_id | string | The group_id of the search suggestion when the search suggestion has an automatically applied group_id filter. Omit in most cases. | |
display_name | string | The display_name of the group when the search suggestion has an automatically applied group_id filter. Omit in most cases. |
Autocomplete - select
Autocomplete select events are sent when a user selects a search suggestion (term) or product.
When an autocomplete Search Suggestion (term) is selected, both an Autocomplete Select and Search Submit event should be triggered. However, if a Product is selected, only an Autocomplete Select event should be triggered.
GET https://ac.cnstrc.com/autocomplete/[term]/select?original_query=[original_query]&tr=[trigger]§ion=[section]&result_id=[result_id]
URL parameters
| Name | Type | Description | Required |
|---|---|---|---|
term | string | The query submitted. This will be the same value as [original_query] in the case where the user typed into the input field and submitted the form. If the user selects a term from an autocomplete suggestion, [term] will be equal to that selected term, where [original_query] would be the originally typed user input. | ✔ |
Query parameters
| Name | Type | Description | Required |
|---|---|---|---|
original_query | string | The actual text the user typed (which may be different than [term] if the user went on to select an autocomplete term suggestion). | ✔ |
tr | string | How the autocomplete select was triggered, either "click" or "enter." | ✔ |
section | string | The section the selection came from, generally either "Search Suggestions" or "Products." | ✔ |
result_id | string | The result_id returned from the Constructor API with the autocomplete result response, if available. | |
group_id | string | The group_id of the search suggestion when the search suggestion has an automatically applied group_id filter. Only applicable to "Search in Category" results. | |
display_name | string | The display_name of the group when the search suggestion has an automatically applied group_id filter. Only applicable to "Search in Category" results. |
Search - results load (PLP)
Search load events are sent when a search result page is loaded (PLP).
POST https://ac.cnstrc.com/v2/behavioral_action/search_result_load
Body parameters
| Name | Type | Description | Required |
|---|---|---|---|
url | string | The current page URL (should be encoded). Maximum 2048 characters. | ✔ |
search_term | string | The current search query string. | ✔ |
items | array of objects | The list of item (product) IDs that appear on the page. Values should correspond with the id value within the product feed. For example: [{ item_id: 'KMH876', variation_id: '123' }, { item_id: 'KMH140' }]. | ✔ |
result_id | string | The result_id from the search response that produced this page (response.result_id). Required when Constructor returns the results on the page. | ✔ |
section | string | The index section. Should be "Products" for most events. | |
result_count | integer | The total number of results returned. | |
result_page | integer | The current page number of results. | |
selected_filters | object | JSON object of currently selected filters, for example: { brand: ['foo'], color: ['black'] }. | |
sort_by | string | The sorting method. | |
sort_order | string | The sorting method order. Generally will be either "ascending" or "descending." |
Search - result click (PLP)
Search result click events are sent when a search result is clicked on a product landing page (PLP).
GET https://ac.cnstrc.com/autocomplete/[term]/click_through?name=[name]&customer_id=[item_id]
URL parameters
| Name | Type | Description | Required |
|---|---|---|---|
term | string | The current search query string. | ✔ |
Query parameters
| Name | Type | Description | Required |
|---|---|---|---|
name | string | The item (product) name that was clicked. This should match the item_name within the product feed. | ✔ |
customer_id | string | The item (product) ID that was clicked. This should match with the id within the product feed. | ✔ |
variation_id | string | The item variation ID of the product that was clicked. This should match the variation_id within the product feed. | |
section | string | The index section. Should be "Products" for most events. |
Browse - results load (PLP)
Browse load events are sent when a browse result page is loaded (PLP).
POST https://ac.cnstrc.com/v2/behavioral_action/browse_result_load
Body parameters
| Name | Type | Description | Required |
|---|---|---|---|
url | string | The current page URL (should be encoded). Maximum 2048 characters. | ✔ |
filter_name | string | The filter name used in the browse request. Generally will be one of "group_id," "collection_id" or a facet key. | ✔ |
filter_value | string | The filter value used in the browse request. | ✔ |
items | array of objects | The list of item (product) IDs that appear on the page. Values should correspond with the id value within the product feed. For example: [{ item_id: 'KMH876', variation_id: '123' }, { item_id: 'KMH140' }]. | ✔ |
result_id | string | The result_id from the browse response that produced this page (response.result_id). Required when Constructor returns the results on the page. | ✔ |
section | string | The index section. Should be "Products" for most events. | |
result_count | integer | The total number of results returned. | |
result_page | integer | The current page number of results. | |
selected_filters | object | JSON object of currently selected filters, for example: { brand: ['foo'], color: ['black'] }. | |
sort_by | string | The sorting method. | |
sort_order | string | The sorting method order. Generally will be either "ascending" or "descending." |
Browse - result click (PLP)
Browse result click events are sent when a browse result is clicked on a product landing page (PLP).
POST https://ac.cnstrc.com/v2/behavioral_action/browse_result_click
Body parameters
| Name | Type | Description | Required |
|---|---|---|---|
filter_name | string | The filter name used in the browse request. Generally will be one of "group_id," "collection_id" or a facet key. | ✔ |
filter_value | string | The filter value used in the browse request. | ✔ |
item_id | string | The item (product) ID that was clicked. This should match with the id within the product feed. | ✔ |
item_name | string | The item (product) name that was clicked. This should match the item_name within the product feed. | ✔ |
result_position_on_page | integer | The position of the item in the browse results. | ✔ |
num_results_per_page | integer | The number of results shown on the page. | |
variation_id | string | The item variation ID of the product that was clicked. This should match the variation_id within the product feed. | |
section | string | The index section. Should be "Products" for most events. | |
result_count | integer | The total number of results returned. | |
result_page | integer | The current page number of results. | |
result_id | string | The result_id returned from the Constructor API with the browse result response, if available. | |
selected_filters | object | JSON object of currently selected filters, for example: { brand: ['foo'], color: ['black'] }. |
Recommendations - result view
Recommendation result view events are sent when recommendations that are powered by Constructor come in the viewport of a user.
POST https://ac.cnstrc.com/v2/behavioral_action/recommendation_result_view
Body parameters
| Name | Type | Description | Required |
|---|---|---|---|
url | string | The current page URL (should be encoded). Maximum 2048 characters. For native apps, where there is no page URL, use a stable identifier for the screen—a deep link such as myapp://SearchMain is valid, and the scheme is not validated. | ✔ |
pod_id | string | The recommendation pod (pod_id) that has been viewed. | ✔ |
num_results_viewed | integer | The number of recommendation items (products) that are in viewport at the time of viewing. | ✔ |
items | array of objects | The list of item (product) IDs that were viewed. Values should correspond with the id value within the product feed. For example: [{ item_id: 'KMH876', variation_id: '123' }, { item_id: 'KMH140' }]. | ✔ |
section | string | The index section. Should be "Products" for most events. | |
result_count | integer | The total number of results returned. | |
result_page | integer | The current page number of results. | |
result_id | string | The result_id returned from the Constructor API with the recommendation result response, if available. | |
seed_item_ids | array of strings | The item ID(s) that the recommendations were seeded from. |
Recommendations - result click
Recommendations result click events are sent when a user clicks on a recommendation that is powered by Constructor.
POST https://ac.cnstrc.com/v2/behavioral_action/recommendation_result_click
Body parameters
| Name | Type | Description | Required |
|---|---|---|---|
pod_id | string | The recommendation pod (pod_id) that has been viewed. | ✔ |
item_id | string | The item (product) ID that was clicked. This should match with the id within the product feed. | ✔ |
item_name | string | The item (product) name that was clicked. This should match the item_name within the product feed. | ✔ |
strategy_id | string | The strategy of the recommendation pod. | ✔ |
result_position_on_page | integer | The position of the item in the recommendation results. | |
num_results_per_page | integer | The number of results shown on the page. | |
variation_id | string | The item variation ID of the product that was clicked. This should match the variation_id within the product feed. | |
result_count | integer | The total number of results returned. | |
section | string | The index section. Should be "Products" for most events. | |
result_id | string | The result_id returned from the Constructor API with the recommendation result response, if available. | |
seed_item_ids | array of strings | The item ID(s) that the recommendations were seeded from. |
Quizzes - load
The Quizzes result load should be sent when using Constructor's quiz product and a user reaches the results page.
POST https://ac.cnstrc.com/v2/behavioral_action/quiz_result_load?section=[section]
Body parameters
| Name | Type | Description | Required |
|---|---|---|---|
quiz_id | string | The quiz_id associated with the quiz. | ✔ |
quiz_version_id | string | The quiz_version_id associated with the quiz - found in the API response. | ✔ |
quiz_session_id | string | The quiz_session_id associated with this quiz - found in the API response. | ✔ |
url | string | The current page URL (should be encoded). Maximum 2048 characters. | ✔ |
result_count | integer | The total number of results returned. | |
result_page | integer | The current page number of results. | |
result_id | string | The result_id returned from the Constructor API with the recommendation result response, if available. |
Quizzes - result click
Quizzes result click events are sent when a user clicks on a result on a Quizzes page.
Body parameters
| Name | Type | Description | Required |
|---|---|---|---|
quiz_id | string | The quiz_id associated with the quiz. | ✔ |
quiz_version_id | string | The quiz_version_id associated with the quiz - found in the API response. | ✔ |
quiz_session_id | string | The quiz_session_id associated with this quiz - found in the API response. | ✔ |
item_id | string | The item (product) ID that was clicked. This should match with the id within the product feed. | ✔ |
item_name | string | The item (product) name that was clicked. This should match the item_name within the product feed. | ✔ |
result_position_on_page | integer | The position of the item in the quizzes results. | |
num_results_per_page | integer | The number of results shown on the page. | |
variation_id | string | The item variation ID of the product that was clicked. This should match the variation_id within the product feed. | |
result_count | integer | The total number of results returned. | |
result_page | integer | The current page number of results. | |
result_id | string | The result_id returned from the Constructor API with the recommendation result response, if available. |
Quizzes - conversion (add to cart)
Quiz conversion events primarily are dispatched when a product is added to a cart, however other types of conversion events exist such as adding to wish list and many more.
POST https://ac.cnstrc.com/v2/behavioral_action/quiz_conversion?section=[section]
Body parameters
| Name | Type | Description | Required |
|---|---|---|---|
quiz_id | string | The quiz_id associated with the quiz. | ✔ |
quiz_version_id | string | The quiz_version_id associated with the quiz - found in the API response. | ✔ |
quiz_session_id | string | The quiz_session_id associated with this quiz - found in the API response. | ✔ |
item_id | string | The item (product) ID that was clicked. This should match with the id within the product feed. | ✔ |
item_name | string | The item (product) name that was clicked. This should match the item_name within the product feed. | ✔ |
revenue | float | The sale price if available, otherwise the regular price of the converted item. | ✔ |
variation_id | string | The item variation ID of the product that was clicked. This should match the variation_id within the product feed. | |
display_name | string | The name of the conversion event - for example, "Add to Cart," "Add to Wish List," "Share." This will be shown in the customer dashboard in the future. It is required if the conversion event is custom and has is_custom_type set to true. | |
type | string | The type of conversion event. Defaults to add_to_cart if the type is not specified. | |
is_custom_type | string | A boolean (true or false) indicating whether the conversion is a custom type event. This should be set to true if you want to pass a custom type |
Generic result click
Generic result click events are sent when a user clicks on an item that is not part of a browse or search PLP experience. For example, items displayed on a homepage, or recommendations that aren't powered by Constructor.
POST https://ac.cnstrc.com/v2/behavioral_action/result_click
Body parameters
| Name | Type | Description | Required |
|---|---|---|---|
item_id | string | The item (product) ID that was clicked. This should match with the id within the product feed. | ✔ |
item_name | string | The item (product) name that was clicked. This should match the item_name within the product feed. | ✔ |
variation_id | string | The item variation ID of the product that was clicked. This should match the variation_id within the product feed. | |
section | string | The index section. Should be "Products" for most events. |
Item detail load (PDP)
Item detail load events are sent when a PDP has been loaded. This event is required if using the recently_viewed_items recommendation strategy.
POST https://ac.cnstrc.com/v2/behavioral_action/item_detail_load
Body parameters
| Name | Type | Description | Required |
|---|---|---|---|
url | string | The current page URL (should be encoded). Maximum 2048 characters. | ✔ |
item_id | string | The item (product) ID that was viewed. This should match with the id within the product feed. | ✔ |
item_name | string | The item (product) name that was viewed. This should match the item_name within the product feed. | ✔ |
variation_id | string | The item variation ID of the product that was viewed. This should match the variation_id within the product feed. | |
section | string | The index section. Should be "Products" for most events. |
Conversion (add to cart)
Conversion events primarily are dispatched when a product is added to a cart, however other types of conversion events exist such as adding to wish list and many more.
POST https://ac.cnstrc.com/v2/behavioral_action/conversion?section=[section]
Body parameters
| Name | Type | Description | Required |
|---|---|---|---|
item_id | string | The item (product) ID that was clicked. This should match with the id within the product feed. | ✔ |
item_name | string | The item (product) name that was clicked. This should match the item_name within the product feed. | ✔ |
revenue | float | The sale price if available, otherwise the regular price of the converted item. | ✔ |
variation_id | string | The item variation ID of the product that was clicked. This should match the variation_id within the product feed. | |
display_name | string | The name of the conversion event - for example, "Add to Cart," "Add to Wish List," "Share." This will be shown in the customer dashboard in the future. It is required if the conversion event is custom and has is_custom_type set to true. | |
type | string | The type of conversion event. Defaults to add_to_cart if the type is not specified. | |
is_custom_type | string | A boolean (true or false) indicating whether the conversion is a custom type event. This should be set to true if you want to pass a custom type | |
section | string | The index section. Should be "Products" for most events. | |
result_id | string | The result_id returned from the Constructor API with the recommendation result response, if available. |
Purchase
Purchase events are dispatched when one or more products are purchased.
POST https://ac.cnstrc.com/v2/behavioral_action/purchase?section=[section]
Body parameters
| Name | Type | Description | Required |
|---|---|---|---|
items | array of objects | The list of item (product) IDs that were purchased. Values should correspond with the id value within the product feed. For example: [{ item_id: 'KMH876', variation_id: '123' }, { item_id: 'KMH140' }]. | ✔ |
revenue | float | The subtotal (not including taxes, shipping, etc.) of the entire order. | ✔ |
order_id | string | A unique order identifier. | ✔ |
section | string | The index section. Should be "Products" for most events. |
Updated 11 days ago