Autosuggest events and attributes
IN_FIELD
Template API:
Refer here for our sample API
Payload details:
Attribute Name | Type | Value to Pass |
---|---|---|
query | string | Suggested query |
autosuggest_type | string | IN_FIELD autosuggest type selected and submitted for search, usually the same as the value of the doctype field in Unbxd autosuggest API |
autosuggest_suggestion | string | Suggested query in Infield |
field_name | string | The name of the field used for the IN_FIELD suggestion |
field_value | string | The value of the field in the suggestion |
unbxdprank | string | Rank of the product from the overall list of suggestions |
internal_query | string | The typed query (the current search string prefix) in the search box, which led to the suggestions in autosuggest |
url | string | Website URL where the search is performed |
visit_type | string | Either "first_time" or "repeat" |
UnbxdKey | string | UnbxdSitekey value |
uid | string | unbxd.userId (Needs to be extracted from the cookie) |
t | string | Timestamp formula: t : current_time | random number between 0 to 1 and t = new Date().getTime() + ‘|’ + Math.random(); |
referrer | string | Link from where the page is opened referrer: sessionStorage.getItem('urlPrevious') || document.referrer || ''; |
POPULAR_PRODUCTS
Template API:
Refer here for our sample API
Payload details:
Attribute Name | Type | Value to Pass |
---|---|---|
query | string | Title of the product |
autosuggest_type | string | POPULAR_PRODUCTS autosuggest type selected and submitted for search, usually the same as the value of the doctype field in Unbxd autosuggest API |
pid | string | Unique id of the product, to be taken from the search API response |
field_name | string | The name of the field used for the IN_FIELD suggestion |
field_value | string | The value of the field in the suggestion |
unbxdprank | string | Rank of the product from the overall list of suggestions |
internal_query | string | The typed query (the current search string prefix) in the search box, which led to the suggestions in autosuggest |
url | string | Website URL where the search is performed |
UnbxdKey | string | UnbxdSitekey value |
uid | string | unbxd.userId (Needs to be extracted from the cookie) |
t | string | Timestamp formula: t : current_time | random number between 0 to 1 and t = new Date().getTime() + ‘|’ + Math.random(); |
The CLICK
event and CART
event will be be applicable to POPULAR_PRODUCTS
.
CLICK
When a popular product is clicked from the autosuggest widget,
-
Fire the autosuggest
POPULAR_PRODUCTS
event. -
Retrieve the
pid
. -
Fire the click event.
CART
-
Fire the autosuggest
POPULAR_PRODUCTS
event. -
Retrieve the
pid
. -
Fire the
click event
. -
After firing the click event, fire the
add to cart
event.
KEYWORD_SUGGESTION
Template API:
Refer here for our sample API
Payload details:
Attribute Name | Type | Value to Pass |
---|---|---|
query | string | Suggested query in keywords |
autosuggest_type | string | KEYWORD_SUGGESTION autosuggest type selected and submitted for search, usually the same as the value of the doctype field in Unbxd autosuggest API |
autosuggest_suggestion | string | Suggested query in Infield |
unbxdprank | string | Rank of the product from the overall list of suggestions |
internal_query | string | The typed query (the current search string prefix) in the search box, which led to the suggestions in autosuggest |
url | string | Website URL where the search is performed |
UnbxdKey | string | UnbxdSitekey value |
uid | string | unbxd.userId (Needs to be extracted from the cookie) |
t | string | Timestamp formula: t : current_time | random number between 0 to 1 and t = new Date().getTime() + ‘|’ + Math.random(); |
referrer | string | Link from where the page is opened referrer: sessionStorage.getItem('urlPrevious') || document.referrer || ''; |
TOP_SEARCH_QUERIES
Template API:
Refer here for our sample API
Payload details:
Attribute Name | Type | Value to Pass |
---|---|---|
query | string | Suggested query |
autosuggest_type | string | TOP_SEARCH_QUERIES autosuggest type selected and submitted for search, usually the same as the value of the doctype field in Unbxd autosuggest API |
autosuggest_suggestion | string | Suggested query in Infield |
unbxdprank | string | Rank of the product from the overall list of suggestions |
internal_query | string | The typed query (the current search string prefix) in the search box, which led to the suggestions in autosuggest |
url | string | Website URL where the search is performed |
UnbxdKey | string | UnbxdSitekey value |
uid | string | unbxd.userId (Needs to be extracted from the cookie) |
t | string | Timestamp formula: t : current_time | random number between 0 to 1 and t = new Date().getTime() + ‘|’ + Math.random(); |
referrer | string | Link from where the page is opened referrer: sessionStorage.getItem('urlPrevious') || document.referrer || ''; |
POPULAR_PRODUCTS_FILTERED
Template API:
Refer here for our sample API
Payload details:
Attribute Name | Type | Value to Pass |
---|---|---|
query | string | Title of the product |
autosuggest_type | string | POPULAR_PRODUCTS_FILTERED autosuggest type selected and submitted for search, usually the same as the value of the doctype field in Unbxd autosuggest API |
pid | string | Unique id of the product, to be taken from the search API response |
unbxdprank | string | Rank of the product from the overall list of suggestions |
internal_query | string | The typed query (the current search string prefix) in the search box, which led to the suggestions in autosuggest |
url | string | Website URL where the search is performed |
UnbxdKey | string | UnbxdSitekey value |
uid | string | unbxd.userId (Needs to be extracted from the cookie) |
t | string | Timestamp formula: t : current_time | random number between 0 to 1 and t = new Date().getTime() + ‘|’ + Math.random(); |
referrer | string | Link from where the page is opened referrer: sessionStorage.getItem('urlPrevious') || document.referrer || ''; |
PROMOTED_SUGGESTION
Template API:
Refer here for our sample API
Payload details:
Attribute Name | Type | Value to Pass |
---|---|---|
query | string | Suggested query |
autosuggest_type | string | PROMOTED_SUGGESTION autosuggest type selected and submitted for search, usually the same as the value of the doctype field in Unbxd autosuggest API |
autosuggest_suggestion | string | Suggested query in Infield |
unbxdprank | string | Rank of the product from the overall list of suggestions |
internal_query | string | The typed query (the current search string prefix) in the search box, which led to the suggestions in autosuggest |
url | string | Website URL where the search is performed |
UnbxdKey | string | UnbxdSitekey value |
uid | string | unbxd.userId (Needs to be extracted from the cookie) |
t | string | Timestamp formula: t : current_time | random number between 0 to 1 and t = new Date().getTime() + ‘|’ + Math.random(); |
referrer | string | Link from where the page is opened referrer: sessionStorage.getItem('urlPrevious') || document.referrer || ''; |
FIELD_TYPE_SUGGESTION
Template API:
Payload details:
Attribute Name | Type | Value to Pass |
---|---|---|
query | string | Suggested query |
autosuggest_type | string | KEYWORD_SUGGESTION autosuggest type selected and submitted for search, usually the same as the value of the doctype field in Unbxd autosuggest API |
autosuggest_suggestion | string | Suggested query in Infield |
unbxdprank | string | Rank of the product from the overall list of suggestions |
internal_query | string | The typed query (the current search string prefix) in the search box, which led to the suggestions in autosuggest |
url | string | Website URL where the search is performed |
UnbxdKey | string | UnbxdSitekey value |
uid | string | unbxd.userId (Needs to be extracted from the cookie) |
t | string | Timestamp formula: t : current_time | random number between 0 to 1 and t = new Date().getTime() + ‘|’ + Math.random(); |
referrer | string | Link from where the page is opened referrer: sessionStorage.getItem('urlPrevious') || document.referrer || ''; |
In addition to the attributes mentioned above, some MANDATORY miscellaneous data must also be included. These should be added under the object named misc
. Please refer to the table below for the specific attributes to be added under misc.
Attribute Name | Type | Value to Pass |
---|---|---|
unxAsType | string | This attribute goes into the misc object to indicate this is a type of FIELD_TYPE_SUGGESTION . |
unxAsFieldName | string | This attribute goes into the misc object to indicate the field on which the FIELD_TYPE_SUGGESTION has been set up. Here, the value can be the field name from the feed. |
Example schema (showcasing only a part of the api): &misc:{“unxAsType”:”FIELD_TYPE_SUGGESTION”,”unxAsFieldName”:”categoryPath1”}
TRENDING_QUERIES
Template API:
Payload details:
Attribute Name | Type | Value to Pass |
---|---|---|
query | string | Suggested query in Infield |
autosuggest_type | string | TOP_SEARCH_QUERIES autosuggest type selected and submitted for search, usually the same as the value of the doctype field in Unbxd autosuggest API |
autosuggest_suggestion | string | Suggested query in Infield |
unbxdprank | string | Rank of the product from the overall list of suggestions |
internal_query | string | The typed query (the current search string prefix) in the search box, which led to the suggestions in autosuggest |
url | string | Website URL where the search is performed |
UnbxdKey | string | UnbxdSitekey value |
uid | string | unbxd.userId (Needs to be extracted from the cookie) |
t | string | Timestamp formula: t : current_time | random number between 0 to 1 and t = new Date().getTime() + ‘|’ + Math.random(); |
referrer | string | Link from where the page is opened referrer: sessionStorage.getItem('urlPrevious') || document.referrer || ''; |
In addition to the attributes mentioned above, some MANDATORY miscellaneous data must also be included. These should be added under the object named misc
. Please refer to the table below for the specific attributes to be added under misc.
Example schema (showcasing only a part of the api): &misc:{“unxAsType”:”TRENDING_QUERIES”}
Attribute Name | Type | Value to Pass |
---|---|---|
unxAsType | string | This attribute goes into the misc object to indicate this is a type of TRENDING_QUERIES . |