Docs

Unbxd Analytics for Browser

Introduction

Tracking visitor analytics and behaviour is essential in order to provide accurate and visitor-specific search and category page results. UNBXD analyzes visitor events, such as product clicks, products added to cart, orders, etc. These events are tracked using browser cookies. With this information, a profile is built for every visitor, based on his/her affinity to different categories, brands, or prices.

This information is then aggregated and analysed for two purposes:

  • Generating reports
  • Providing relevant and personalised search & category pages results

When visitors browse through your store, the integrated trackers log everything visitors do - the products they visit, orders, even the various store properties they interact with. We take that information, analyze it, and assemble a detailed profile of the visitor. We know their browsing patterns, preferences and can even determine susceptibility to merchandising campaigns. The trackers are unique tracking codes that must be configured onto the store properties that yield an interaction. We call this interaction as an "event", for example, on the "Add to Cart" button.
The visitor profiles help fetch relevant and personalized products as search results. It also helps in generating detailed reports.

Note: For Unbxd Ecommerce Search to function correctly on your site, Unbxd Analytics must be configured.

How to Integrate?

Types of Analytics Integration:

1.Browser-based Analytics Integration
2.REST API-based Analytics Integration

We do recommend that the customer follow Browser-based Analytics Integration, where in customer does the integration by including Unbxd javascript library. Unbxd javascript library performs all the operations without the customer investing integration effort. But in case of mobile SDK, Amazon Alexa or any kind of non-browser based Unbxd integration, customers have to use RESTful API-based analytics integration.

The conventional way to integrating Unbxd Analytics is a simple two-step process:

1.Including unbxdAnalytics.js script
2.Tracking events

1. Including unbxdAnalytics.js script

Your first step is to insert a JavaScript code within all the HTML pages in your website. This JavaScript code is responsible for pushing the visitor events to Unbxd.

Notes:

  • The JavaScript code will not affect the performance of the page as it is loaded asynchronously.
  • This code could be inserted anywhere in the page (header, body, footer) and need not be included in the head section of the HTML.

Javascript code

<script type = "text/javascript" >  
/* * * CONFIGURATION * * */
var UnbxdSiteName = "<Site_ Key >" ; // Replace the value with your Site Key. /* * * DON'T EDIT BELOW THIS LINE * * */

( function () {

var ubx = document . createElement ( 'script' ); ubx . type = 'text/javascript' ; ubx . async = true ;

ubx . src = '//d21gpk1vhmjuf5.cloudfront.net/unbxdAnalytics.js' ;

( document . getElementsByTagName ( 'head' )[ 0 ] || document . getElementsByTagName ( 'body' )[ 0 ]). appendChild ( ubx );

})(); </script>

< Site_Key> is generated at the time of account creation and can be accessed at Manage -> Configure Site -> Keys on console.unbxd.com

This JavaScript snippet automatically:

  • Tracks new visitors and makes their profiles (files) using browser cookies. This information is stored within the browser cookie having the name ‘unbxd.userId’ .
  • Tracks and pushes the events to the Unbxd.

2. Tracking Events

There are two ways to integrate the tracking of visitor events:

i) Using custom HTML attributes

Unbxd provides dedicated HTML attributes for tracking each event, which must be inserted within the required HTML Tags as specified below.

ii) Using API Calls

You can also track visitor events by setting up event-triggered API calls to Unbxd at the backend of your ecommerce store. These event based API calls will track each visitor event and store it in the Unbxd Cloud server until the visitor clears his browser cookies. Unbxd has dedicated APIs for tracking the different visitor events.

General API Syntax:

Unbxd . track ( type , params )  
  • type : “search”,”categoryPage”,”widgetImpression”,”click”,”addToCart”,”order”
  • params : parameters based on type of visitor event.

Both the integration methods are explained in the respective sections below.

Events

The actions a visitor takes on your ecommerce store are known as Events . The following events can be tracked on your online store:

  • Visitor
  • Search Hit
  • Category Page Hit
  • Product Click
  • Add to Cart
  • Orders
  • Product Page View
  • Cart Removal
  • Recommendation Widget Impression
  • Search Impression
  • Browse Impression
  • Dwelltime (time spent on a product page)
  • Facets (filters applied for search or browse event)

Visitor

The Visitor event is tracked to identify "first-time" vs "repeat" visitors and thereby help track other events. Every time the visitor event is fired, this information is extracted from the visitor’s browser cookie, which contains a “visitType” parameter (also used by other events) that is set to "first-time" or "repeat".

This cookie has an expiry time of 30 minutes. Once expired, the cookie is reset with a new "visitType" value. This means, if a visitor sticks around for more than 30 minutes, he/she will become a "repeat" visitor. The visitor information is stored until the visitor's browser cookies are cleared.

Note: If the customer uses Unbxd analytics javascript, this event is tracked and pushed automatically, with no changes required from the customer.

Search Hit

A Search hit event is tracked to understand the query and intent of your visitors. Each search query is tracked to enable per-query analytics of the visitor. A typical search hit event involves:

  • Typing the query
  • Pressing Enter or Clicking the Search button
i) Using custom HTML attributes

The unbxdattr="sq" attribute is inserted within the <input> tag of the search text box to capture the search query typed by the visitor.

<input placeholder = "Search" unbxdattr = "sq" /> The unbxdattr="sq_bt" attribute is inserted on the link or button (usually the magnification/search icon) that triggers search at the backend:

<button type = "submit" unbxdattr = "sq_bt" > Search </button>

ii) Using API Calls

Search hits can also be tracked by calling the javascript API below with the search query as a parameter, when a visitor searches in the search text box.

API syntax:

Unbxd . track ( "search" , { "query" : <QUERY> })  

<QUERY> : the search query Example:

Unbxd . track ( "search" , { "query" : "dress" });  

Category Page Hit

Category pages are the product listing pages, a visitor visits while browsing on the ecommerce website. For example, pages for categories such as Women -> Dresses, Men ->Shirts, etc on the website. These are also called browse or navigation pages. This event tracks the number of visits for a particular category page.

For more information, refer to Category API documentation. To understand the user behavior on the category pages, customer needs to add the following javascript snippet on their corresponding pages.

<script type = "text/javascript">  
UnbxdAnalyticsConf = window . UnbxdAnalyticsConf || {}; UnbxdAnalyticsConf [ "page" ] = < PAGE >; UnbxdAnalyticsConf [ "page_type" ] = < PAGE_TYPE > ;    </script>  
  • <page> : This is the unique identifier for the page passed in the category page API as parameter ‘p’. The value could be an id, name or a filter associated with the category. For instance, ‘page’ could be ‘cat243005’ (an id or a name) or ‘categoryPathId: ”EC>EC1”’ (filtering on the product attribute categoryPathId).
  • <page_type> : Specifies the type of value in the ‘page’ parameter. Please refer to the table below for the accepted range of values:
pagepage_typeremarks
cat243005CATEGORY_PATHIf the ‘page’ value is simply the ID or name of the associated category, then page_type is "CATEGORY_PATH"
categoryPathId: Parent>ChildBOOLEANIf the ‘page’ value is based on a conditional filter on a certain attribute (categoryPathId is the attribute in this case), then page_type is "BOOLEAN"
https://www.example.com/shop/URLSet page_type to "URL" when tracking hits for a landing page.

Example:
For Category women -> dress:

<script type = "text/javascript">  
UnbxdAnalyticsConf = window . UnbxdAnalyticsConf || {}; UnbxdAnalyticsConf [" page "] = " women > dresses" UnbxdAnalyticsConf [" page_type "] = " CATEGORY_PATH"  
</script>  

For Brand Nike:

<script type = "text/javascript">  
UnbxdAnalyticsConf = window . UnbxdAnalyticsConf || {}; UnbxdAnalyticsConf [" page "] = " nike" UnbxdAnalyticsConf [" page_type "] = " CATEGORY_PATH"  
</script>  

Note: The "UnbxdAnalyticsConf[]" object needs to be configured before the "unbxdAnalytics.js" gets loaded on the page. Thus, this snippet needs to be added before including unbxdAnalytics.js script (Step1).

Search & Category Page Response

For every search, category path and recommendation request that is received at the Unbxd search platform servers a requestId is generated and associated with the request. This id is also sent back to the client by setting it in the response headers.

Sample Request:

$ curl -i  'http://search.unbxd.io/<api_key>/<isitename>/search?q=shirt&fl=product_name'

Sample Response:

HTTP/1.1 200 OK  
Content-Type: application/json; charset=UTF-8  
Date: Thu, 01 Mar 2018 09:32:34 GMT  
Server: Wingman v0.1.4  
Unbxd-Request-Id: 607a0bbf-179a-44af-8bdd-e58fef7fc5f3  
X-Request-Id: 607a0bbf-179a-44af-8bdd-e58fef7fc5f3  
Content-Length: 2420  
Connection: keep-alive  
{"response":{"numberOfProducts":1418,"start":0,"products":[{"product_name":"Lancôme Juicy Shaker","uniqueId":"10071423"..}

Any subsequent analytics events (preferably clicks and carts on the search and category listing page) fired when the user interacts with the results must provide the requestId of the response responsible for populating the listing page. The details of the analytics integration required so that this information flows to analytics servers has been captured below.

Product Click

Tracking product clicks of visitors helps our search engine to understand their preferences over other products on the listing page. This information is used to compute popular products and render relevant and personalized results . It needs to be tracked in case of search and navigation pages. It is also integrated if customer is using the recommendation widgets.

1.Using custom HTML attributes

The following attributes are inserted within the product <div>(product thumbnail) or within the <li> html tags that displays lists of products on the search results page or category page:

<li unbxdattr = "product" unbxdparam_sku = "SKU001" unbxdparam_prank = "1" unbxdparam_requestId = "607a0bbf-179a-44af-8bdd-e58fef7fc5f3" ></li>  

Or

<div unbxdattr = "product" unbxdparam_sku = "SKU001" unbxdparam_prank = "1" unbxdparam_requestId = "607a0bbf-179a-44af-8bdd-e58fef7fc5f3" ></div>  
  • unbxdattr: Specifies the type of event getting captured. For product clicks, the value is "product"
  • unbxdparam_sku: uniqueId of the product as defined in the feed schema.
  • Unbxdparam_prank: The rank at which the SKU appears among the search results for a query in the grid/list. The first product will have the value of this parameter as “1”, while the second product will have the value as “2” and sequentially even other products will be ranked accordingly
  • unbxdparam_requestId: The unbxd request id returned in the search/category page api call response.

In case customer is using Unbxd Recommendations, an attribute unbxdParam_boxType has to be added within the tag with value for corresponding recommendation widget.

Example for Recommended for You recommendation widget:

<li unbxdattr = "product" unbxdparam_sku = "SKU001" unbxdparam_prank = "1"  
unbxdParam_boxType = "RECOMMENDED_FOR_YOU" unbxdparam_requestId = "607a0bbf-179a-44af-8bdd-e58fef7fc5f3" ></li>  
  • unbxdattr: Specifies the type of event getting captured. For product clicks, the value is "product"
  • unbxdparam_sku: This is the ‘uniqueId’ of the product as defined in the feed. For more information, refer the feed documentation.

    Note: Even if your products have variants, please do not pass the variant id here. We capture the click on the rolled-up entity and not on the individual variant on the search results page.

  • unbxdparam_prank: The rank at which the SKU appears within the recommendation widget. The first product will have the value of this parameter as “1”, while the second product will have the value as “2” and sequentially even other products will be ranked accordingly

  • unbxdparam_requestId: The unbxd request id returned in the recommendations api call response.
  • unbxdParam_boxType: Specifies the type of recommendation widget. For different permissible values, refer the table below.
Widget TypeBox Type Value
Recommended For YouRECOMMENDED_FOR_YOU
Recently Viewed RECENTLY_VIEWED
More Like These MORE_LIKE_THESE
Viewed also Viewed ALSO_VIEWED
Bought also Bought ALSO_BOUGHT
Cart Recommendations CART_RECOMMEND
HomePage Top Sellers TOP_SELLERS
Category Top Sellers CATEGORY_TOP_SELLERS
Brand Top Sellers BRAND_TOP_SELLERS

2. Using API Calls

Every time a visitor clicks on a product in a search results page, category page, or an Unbxd recommendation widget, the following API needs to be called:

API Syntax:

Unbxd.track ( "click" ,{ "pid" : <PID> , "prank" : <PRANK> , "requestId" : <REQUESTID>})  
  • <PID>: uniqueID of the product as passed in the feed.

    Note: Even if your products have variants, please do not pass variant id here. We capture the click on the rolled-up entity and not on the individual variant on the search results page.

  • <PRANK> : rank at which the SKU appears among the search results for a query in the grid/list. The first product will have Rank 1 and so on.
  • <REQUESTID> : The unbxd request id returned in the search/category page/recommendations api call response.

Example:

Unbxd.track( "click" ,{ "pid" : "123" , "prank" : "3" , "requestId" : "607a0bbf-179a-44af-8bdd-e58fef7fc5f3"});  

If you are tracking products clicks on a recommendation widget, you need to call the following API from your Javascript file (in case customer is using Unbxd Recommendations):

API Syntax:

Unbxd.track( "click" ,{ "pid" : <PID> , "prank" : <PRANK> , "boxType" : <BoxType>  
 , "requestId" : <REQUESTID>})  

BoxType (optional): Type of the Unbxd recommendation widget if its one. Please refer ‘Table i’ above for the value of this parameter.

For example:

Unbxd.track ( "click" ,{ "pid" : "123" , "prank" : "3" , "boxType" : "RECOMMENDED_FOR_YOU" , "requestId" : "607a0bbf-179a-44af-8bdd-e58fef7fc5f3"})  

Note: Customer doesn’t have to include this parameter if the recommendation is not powered by Unbxd.

For both HTML attributes and API based, it is recommended to set the information below for better tracking.

For Search result page, you can set the query information (below format) before loading Unbxd analytics tracking plugin:

<script type = "text/javascript">  
      UnbxdAnalyticsConf = window . UnbxdAnalyticsConf || {}; 
      UnbxdAnalyticsConf ["query"] = " nike";
</script>  

For Category result page, you can set the page information (below format) before loading Unbxd analytics tracking plugin:

<script type = "text/javascript">  
     UnbxdAnalyticsConf = window . UnbxdAnalyticsConf || {}; 
     UnbxdAnalyticsConf ["page"] = " nike";
     UnbxdAnalyticsConf [" page_type "] = " CATEGORY_PATH";
</script>  

Cart Additions

Tracking products added to the cart help us further improve product ranks for a search query.

1.Using custom HTML attributes

The following attributes need to be inserted within the HTML element of the Add to Cart button on your site.

<input unbxdattr = "AddToCart" unbxdparam_sku = "SKU001" unbxdparam_variant = "VAR001" unbxdparam_qty = "2" unbxdparam_requestId = "607a0bbf-179a-44af-8bdd-e58fef7fc5f3">  
  • unbxdattr: Specifies the type of event getting captured. For product clicks, the value is "AddToCart".
  • unbxdparam_sku: UniqueId of the product as defined in the feed schema.
  • unbxdparam_variant (optional): Variantid of the variant added to the cart as defined in the feed schema. This parameter is optional and needed only if the catalog has variants.
  • unbxdparam_qty (optional): The number of variants that are added to the cart. If not present, the default value assumed is 1.
  • unbxdparam_requestId: The unbxd request id, if available. When the add to cart option is available for the product at the product listing page/recommendation widget, the request id is available. It should be passed with the cart event.

2.Using API Calls

The API below along with its corresponding event parameter values, needs to be called from your JavaScript on the cart add event.

API Syntax:

For products without variants:

Unbxd.track( "addToCart" , { "pid" : <PID> , "qty" : <QTY> , "requestId" : <REQUESTID> })  

For products with variants:

Unbxd.track( "addToCart" , { "pid" : <PID> , "variantId" : <VID> , "qty" : <QTY>  , "requestId" : <REQUESTID> })  
  • <PID>: UniqueId of the product as defined in the feed schema.
  • <VID>: (optional) : Variantid of the variant added to the cart as defined in the feed schema. If not present, Unbxd won’t be able to track variants.
  • <QTY> (optional): The number of variants that are added to the cart. If not present, the default value assumed is 1.
  • <REQUESTID>: The unbxd request id, if available. When the add to cart shortcut is available for the product at the product listing page/recommendation widget, the request id is available. It should be passed with the cart event.

Example:

For products without variants, you can use:

Unbxd.track( "addToCart" , { "pid" : "123" , "qty" : "2" , "requestId" : "607a0bbf-179a-44af-8bdd-e58fef7fc5f3" });  

For products with variants, you can use:

Unbxd . track ( "addToCart" , { "pid" : "123" , "variantId" : "456" ,"qty" : "2" , "requestId" : "607a0bbf-179a-44af-8bdd-e58fef7fc5f3"});  

Note: For both HTML attributes and API based, it is recommended to set the information below for better tracking.

For Search result page, you can set the query information (below format) before loading Unbxd analytics tracking plugin:

<script type = "text/javascript">  
  UnbxdAnalyticsConf = window . UnbxdAnalyticsConf || {}; 
  UnbxdAnalyticsConf ["query"] = " nike";  
</script>  

For Category result page, you can set the page information (below format) before loading Unbxd analytics tracking plugin:

<script type = "text/javascript">  
  UnbxdAnalyticsConf = window . UnbxdAnalyticsConf || {}; 
  UnbxdAnalyticsConf ["page"] = " nike";
  UnbxdAnalyticsConf [" page_type "] = " CATEGORY_PATH";
</script>  

Orders

Unbxd analytics also track orders placed by the visitor from your ecommerce store.

i) Using custom HTML attributes

The following attributes need to be inserted within the HTML tags on the order confirmation / success page for each product that has been ordered.

<li unbxdattr = "order" unbxdparam_sku = "SKU001" unbxdparam_variant = "VAR001" unbxdparam_price = "500" unbxdparam_qty = "2" ></li>  
  • unbxdattr: Specifies the type of event getting captured. For product clicks, the value is "order".
  • unbxdparam_sku: UniqueId of the product as defined in the feed.
  • unbxdparam_variant (optional): UniqueId of the variant as defined in the feed. This parameter is optional and needed only if the catalog has variants.
  • unbxdparam_price: Price of the product/variant bought.
  • unbxdparam_qty: Quantity of the product/variant bought.

Note: Add these attributes to the tags on the order confirmation/success page as order can only be tracked after it’s placed successfully. Tracking event would be fired once for each tag present on the confirmation page.

ii) Using API Calls

Every time a customer successfully orders a product, the API below along with its corresponding event parameter values needs to be called from your JavaScript file.

API Syntax:

For products without variants:

Unbxd . track ( "order" ,{ "pid" : <PID> , "qty" : <QTY> , "price" : <PRICE> })  

For products with variants:

Unbxd . track ( "order" , { "pid" : <PID> , "variantId" : <VID> , "qty" : <QTY> , "price" : <PRICE> })  
  • <PID>: UniqueId of the product as defined in the feed schema.
  • <VID> (optional) : Variantid of the variant added to the cart as defined in the feed schema. If not present, Unbxd won’t be able to track variants .
  • <QTY> (optional): The number of variants that are added to the cart. If not present, the default value assumed is 1.
  • <PRICE>: Price of the product ordered.

Example:

For products without variants:

Unbxd . track ( "order" ,{ "pid" : "123" , "qty" : "2" , "price" : "450" });  

For products with variants:

Unbxd . track ( "order" , { "pid" : "123" , "variantId" : "456" , "qty" : 2 , "price" : 25.60 });  

Product Page View

Product Page View indicates the total number of visits that has been made to the product details page (PDP) by the visitor irrespective of the source (search result page, category page, search engine, email, marketing campaigns, etc). This can be tracked by adding the following javascript snippet to each of the product description pages on your website.

<script type = "text/javascript">  
UnbxdAnalyticsConf = window . UnbxdAnalyticsConf || {}; UnbxdAnalyticsConf [ 'pid' ] = <PID>;  
</script>  

<PID>: UniqueId of the product

Note: The "UnbxdAnalyticsConf[]" object needs to be configured before the "unbxdAnalytics.js" gets loaded on the page. Thus, this snippet needs to be added before including unbxdAnalytics.js script (Step 1).

Cart Removal

Like "Cart Additions", tracking "Cart Removal" is also important as it helps us better understand the visitor's preferences. Following are the ways to integrate this event:

i) Using custom HTML attributes

The attributes below must be added within all "cart removal" buttons on the cart page. For example:

<button unbxdattr = "RemoveFromCart" unbxdparam_sku = "SKU001" unbxdparam_variant = "VAR001" unbxdparam_price = "500" unbxdparam_qty = "2" >  
  • unbxdattr: Specifies the type of event getting captured. For cart removal, the value is "RemoveFromCart".
  • unbxdparam_sku : UniqueId of the product as defined in the feed.
  • unbxdparam_variant (optional): UniqueId of the variant as defined in the feed. This parameter is optional and needed only if the catalog has variants.
  • unbxdparam_price: Price of the product/variant bought.
  • unbxdparam_qty (optional): Quantity of the product/variant bought.
ii) Using API Calls

To track the “Cart Removal”, customer needs to call the Unbxd API on the cart Removal event. The following javascript API needs to be triggered on the corresponding event.

Unbxd . track ( "cartRemoval" , { "pid" : <PID> , "qty" : <QTY> })  
  • <PID> : Unique ID or SKU ID of the product.
  • <QTY> : Number of products that are removed from the cart.

Example:

Unbxd . track ( " cartRemoval " , { " pid " : " S0012 " , " qty " : 1 })  

Recommendation Widget Impression

If you are subscribed to Unbxd Recommendations, every time the Recommendation widget loads, the API below needs to be called from your JavaScript file with category name as the parameter.

i) Using custom HTML attributes
<div unbxdAttr="product" unbxdParam_boxtype="ALSO_VIEWED" unbxdParam_source_pid="1001">  
ii) Using API Calls
Unbxd.track('widgetImpression', {boxType : boxType, identifier : identifier, pids_list : pids_list})  
  • identifier: this can be pid (product Id), category, or brand.

Example:

Unbxd.track("widgetImpression", {"boxType":"MORE_LIKE_THESE", "identifier":"Adidas", pids_list: [“a001”, “a002”]});  

Search Impression

A search impression event is fired when a search results page loads for the first time, and whenever results change on applying pagination, autoscroll, sort, and filters. For each of these actions, unique Ids of the products visible on the search page should be sent as payload.

i) Using custom HTML attributes
<li unbxdAttr="product" unbxdparam_sku="60053">  

You can set the query information using the script tag below:

<script type = "text/javascript">  
            UnbxdAnalyticsConf = window . UnbxdAnalyticsConf || {}; 
            UnbxdAnalyticsConf ["query"] = " nike";
</script>  
  • <query>: Search query (type String)
ii) Using API Calls
Unbxd.track('search_impression', {query : query, pids_list : pids_list})  
  • <query> - Search query.
  • <pids_list> - List of newly loaded pids.

Example:

Unbxd.track('search_impression', {query : ‘shirt’, pids_list : [‘a001’,’a002’]})  

Category Page Impression

A category page impression event is fired when results of the category page loads for first time, and whenever the results change on applying pagination, autoscroll, sort, and filters. For each of these actions, unique Ids of the products visible on the search page should be sent as payload.

i) Using custom HTML attributes
<li unbxdAttr="product" unbxdparam_sku="60053" >  

Also, add the script below before Unbxd analytics library is loaded.

<script type = "text/javascript">  
      UnbxdAnalyticsConf = window . UnbxdAnalyticsConf || {};          UnbxdAnalyticsConf[page] = <page>;
      UnbxdAnalyticsConf[page_type] = <page_type>;
</script>  
ii) Using API Calls
Unbxd.track('browse_impression', {page : <page>, page_type: <page_type>, pids_list : pids_list})  
  • <page> : This is the unique identifier for the page passed in the category page API as parameter ‘p’. The value could be an id, name or a filter associated with the category. For instance, ‘page’ could be ‘cat243005’ (an id or a name) or ‘categoryPathId: ”EC>EC1”’ (filtering on the product attribute categoryPathId).
  • <page_type> : Specifies the type of value in the ‘page’ parameter. Please refer to the table below for the accepted range of values:
pagepage_typeremarks
cat243005CATEGORY_PATHIf the ‘page’ value is simply the ID or name of the associated category, then page_type is "CATEGORY_PATH"
categoryPathId: Parent>ChildBOOLEANIf the ‘page’ value is based on a conditional filter on a certain attribute (categoryPathId is the attribute in this case), then page_type is "BOOLEAN"
https://www.example.com/shop/URLSet page_type to "URL" when tracking hits for a landing page.
  • <pids_list> : list of newly loaded pids

Example:

Unbxd.track('browse_impression', {page : ‘/men/shirt’, page_type: ‘URL’, pids_list : [‘a001’,’a002’]})  

Dwelltime (time spent on a product page)

A dwellTime event is used to capture the amount of time spent on a product details page.

i) Using script tag
<script type = "text/javascript">  
     UnbxdAnalyticsConf = window . UnbxdAnalyticsConf || {}; 
     UnbxdAnalyticsConf['pid'] = <pid>  // if set will be treated page as PDP
</script>  

<pid>: UniqueId of the product

ii) Using API Calls
Unbxd.track(‘dwellTime', {pid : pid, dwellTime : dwellTime})  
  • <pid>: UniqueId of the product.
  • <dwellTime>: Time spent on the product details page in milliseconds.

Note: Even though dwellTime takes in numeric values, it is still passed in double quotes.

Example:

Unbxd.track(‘dwellTime', {pid : “a001”, dwellTime : "100001"})  

Facets (filters applied for search or browse event)

A facet event is fired when a filter is applied on Search or Category pages.

i) Using script tag
<input unbxdparam_facetname="color" unbxdParam_facetValue="red" checked>  

For Search page:

<script type = "text/javascript">  
       UnbxdAnalyticsConf = window.UnbxdAnalyticsConf || {};
       UnbxdAnalyticsConf['query'] = <search-query>;
</script>  

Note: If UnbxdAnalyticsConf.query is not set, it will check for url params, and the search query key will be taken from the search input attribute name.

For Category page:

<script type = "text/javascript">  
            UnbxdAnalyticsConf = window . UnbxdAnalyticsConf || {}; 
      UnbxdAnalyticsConf[page] = <page>;
      UnbxdAnalyticsConf[page_type] = <page_type>;
</script>  
ii) Using API Calls

For Search page:

Unbxd.track('facets', {query : <query>, facets : <facets>})  

For Category page:

Unbxd.track('facets', {page : <path>, page_type: <page_type>, facets : <facets>})  
  • <facets>: All currently applied facets (type json object)
  • <page> : This is the unique identifier for the page passed in the category page API as parameter ‘p’. The value could be an id, name or a filter associated with the category. For instance, ‘page’ could be ‘cat243005’ (an id or a name) or ‘categoryPathId: ”EC>EC1”’ (filtering on the product attribute categoryPathId).
  • <page_type> : Specifies the type of value in the ‘page’ parameter. Please refer to the table below for the accepted range of values:
pagepage_typeremarks
cat243005CATEGORY_PATHIf the ‘page’ value is simply the ID or name of the associated category, then page_type is "CATEGORY_PATH"
categoryPathId: Parent>ChildBOOLEANIf the ‘page’ value is based on a conditional filter on a certain attribute (categoryPathId is the attribute in this case), then page_type is "BOOLEAN"
https://www.example.com/shop/URLSet page_type to "URL" when tracking hits for a landing page.

Example:

Unbxd.track('facets', {query : “shirts”, facets : {"fit_fq":["Fitted"]}}