Direct to API tracking

🚧

Warning

Constructor 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:

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_id cookie.
    • 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 clientId field on an instance of the client when using our iOS client library.
  • 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_id cookie.
    • 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 sessionId field on an instance of the client when using our iOS client library.
  • 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

NameTypeDescriptionRequired
termstringThe 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

NameTypeDescriptionRequired
original_querystringThe actual text the user typed (which may be different than [term] if the user went on to select an autocomplete term suggestion).✔
result_idstringThe result_id returned from the Constructor API with the autocomplete result response, if available.
group_idstringThe group_id of the search suggestion when the search suggestion has an automatically applied group_id filter. Omit in most cases.
display_namestringThe 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

NameTypeDescriptionRequired
termstringThe 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

NameTypeDescriptionRequired
original_querystringThe actual text the user typed (which may be different than [term] if the user went on to select an autocomplete term suggestion).✔
trstringHow the autocomplete select was triggered, either "click" or "enter."✔
sectionstringThe section the selection came from, generally either "Search Suggestions" or "Products."✔
result_idstringThe result_id returned from the Constructor API with the autocomplete result response, if available.
group_idstringThe 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_namestringThe 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

NameTypeDescriptionRequired
urlstringThe current page URL (should be encoded). Maximum 2048 characters.✔
search_termstringThe current search query string.✔
itemsarray of objectsThe 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_idstringThe result_id from the search response that produced this page (response.result_id). Required when Constructor returns the results on the page.✔
sectionstringThe index section. Should be "Products" for most events.
result_countintegerThe total number of results returned.
result_pageintegerThe current page number of results.
selected_filtersobjectJSON object of currently selected filters, for example: { brand: ['foo'], color: ['black'] }.
sort_bystringThe sorting method.
sort_orderstringThe 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

NameTypeDescriptionRequired
termstringThe current search query string.✔

Query parameters

NameTypeDescriptionRequired
namestringThe item (product) name that was clicked. This should match the item_name within the product feed.✔
customer_idstringThe item (product) ID that was clicked. This should match with the id within the product feed.✔
variation_idstringThe item variation ID of the product that was clicked. This should match the variation_id within the product feed.
sectionstringThe 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

NameTypeDescriptionRequired
urlstringThe current page URL (should be encoded). Maximum 2048 characters.✔
filter_namestringThe filter name used in the browse request. Generally will be one of "group_id," "collection_id" or a facet key.✔
filter_valuestringThe filter value used in the browse request.✔
itemsarray of objectsThe 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_idstringThe result_id from the browse response that produced this page (response.result_id). Required when Constructor returns the results on the page.✔
sectionstringThe index section. Should be "Products" for most events.
result_countintegerThe total number of results returned.
result_pageintegerThe current page number of results.
selected_filtersobjectJSON object of currently selected filters, for example: { brand: ['foo'], color: ['black'] }.
sort_bystringThe sorting method.
sort_orderstringThe 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

NameTypeDescriptionRequired
filter_namestringThe filter name used in the browse request. Generally will be one of "group_id," "collection_id" or a facet key.✔
filter_valuestringThe filter value used in the browse request.✔
item_idstringThe item (product) ID that was clicked. This should match with the id within the product feed.✔
item_namestringThe item (product) name that was clicked. This should match the item_name within the product feed.✔
result_position_on_pageintegerThe position of the item in the browse results.✔
num_results_per_pageintegerThe number of results shown on the page.
variation_idstringThe item variation ID of the product that was clicked. This should match the variation_id within the product feed.
sectionstringThe index section. Should be "Products" for most events.
result_countintegerThe total number of results returned.
result_pageintegerThe current page number of results.
result_idstringThe result_id returned from the Constructor API with the browse result response, if available.
selected_filtersobjectJSON 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

NameTypeDescriptionRequired
urlstringThe 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_idstringThe recommendation pod (pod_id) that has been viewed.✔
num_results_viewedintegerThe number of recommendation items (products) that are in viewport at the time of viewing.✔
itemsarray of objectsThe 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' }].✔
sectionstringThe index section. Should be "Products" for most events.
result_countintegerThe total number of results returned.
result_pageintegerThe current page number of results.
result_idstringThe result_id returned from the Constructor API with the recommendation result response, if available.
seed_item_idsarray of stringsThe 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

NameTypeDescriptionRequired
pod_idstringThe recommendation pod (pod_id) that has been viewed.✔
item_idstringThe item (product) ID that was clicked. This should match with the id within the product feed.✔
item_namestringThe item (product) name that was clicked. This should match the item_name within the product feed.✔
strategy_idstringThe strategy of the recommendation pod.✔
result_position_on_pageintegerThe position of the item in the recommendation results.
num_results_per_pageintegerThe number of results shown on the page.
variation_idstringThe item variation ID of the product that was clicked. This should match the variation_id within the product feed.
result_countintegerThe total number of results returned.
sectionstringThe index section. Should be "Products" for most events.
result_idstringThe result_id returned from the Constructor API with the recommendation result response, if available.
seed_item_idsarray of stringsThe 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

NameTypeDescriptionRequired
quiz_idstringThe quiz_id associated with the quiz.✔
quiz_version_idstringThe quiz_version_id associated with the quiz - found in the API response.✔
quiz_session_idstringThe quiz_session_id associated with this quiz - found in the API response.✔
urlstringThe current page URL (should be encoded). Maximum 2048 characters.✔
result_countintegerThe total number of results returned.
result_pageintegerThe current page number of results.
result_idstringThe 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

NameTypeDescriptionRequired
quiz_idstringThe quiz_id associated with the quiz.✔
quiz_version_idstringThe quiz_version_id associated with the quiz - found in the API response.✔
quiz_session_idstringThe quiz_session_id associated with this quiz - found in the API response.✔
item_idstringThe item (product) ID that was clicked. This should match with the id within the product feed.✔
item_namestringThe item (product) name that was clicked. This should match the item_name within the product feed.✔
result_position_on_pageintegerThe position of the item in the quizzes results.
num_results_per_pageintegerThe number of results shown on the page.
variation_idstringThe item variation ID of the product that was clicked. This should match the variation_id within the product feed.
result_countintegerThe total number of results returned.
result_pageintegerThe current page number of results.
result_idstringThe 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

NameTypeDescriptionRequired
quiz_idstringThe quiz_id associated with the quiz.✔
quiz_version_idstringThe quiz_version_id associated with the quiz - found in the API response.✔
quiz_session_idstringThe quiz_session_id associated with this quiz - found in the API response.✔
item_idstringThe item (product) ID that was clicked. This should match with the id within the product feed.✔
item_namestringThe item (product) name that was clicked. This should match the item_name within the product feed.✔
revenuefloatThe sale price if available, otherwise the regular price of the converted item.✔
variation_idstringThe item variation ID of the product that was clicked. This should match the variation_id within the product feed.
display_namestringThe 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.
typestringThe type of conversion event. Defaults to add_to_cart if the type is not specified.
is_custom_typestringA 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

NameTypeDescriptionRequired
item_idstringThe item (product) ID that was clicked. This should match with the id within the product feed.✔
item_namestringThe item (product) name that was clicked. This should match the item_name within the product feed.✔
variation_idstringThe item variation ID of the product that was clicked. This should match the variation_id within the product feed.
sectionstringThe 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

NameTypeDescriptionRequired
urlstringThe current page URL (should be encoded). Maximum 2048 characters.✔
item_idstringThe item (product) ID that was viewed. This should match with the id within the product feed.✔
item_namestringThe item (product) name that was viewed. This should match the item_name within the product feed.✔
variation_idstringThe item variation ID of the product that was viewed. This should match the variation_id within the product feed.
sectionstringThe 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

NameTypeDescriptionRequired
item_idstringThe item (product) ID that was clicked. This should match with the id within the product feed.✔
item_namestringThe item (product) name that was clicked. This should match the item_name within the product feed.✔
revenuefloatThe sale price if available, otherwise the regular price of the converted item.✔
variation_idstringThe item variation ID of the product that was clicked. This should match the variation_id within the product feed.
display_namestringThe 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.
typestringThe type of conversion event. Defaults to add_to_cart if the type is not specified.
is_custom_typestringA 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
sectionstringThe index section. Should be "Products" for most events.
result_idstringThe 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

NameTypeDescriptionRequired
itemsarray of objectsThe 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' }].✔
revenuefloatThe subtotal (not including taxes, shipping, etc.) of the entire order.✔
order_idstringA unique order identifier.✔
sectionstringThe index section. Should be "Products" for most events.

Did this page help you?