Docs

Unbxd Analytics

Unbxd Analytics is a simple tracking algorithm that can be easily implemented on your ecommerce store for tracking visitor events.

What are Events?

The actions a visitor takes on your ecommerce store are known as Events. Following are the different events we track on your online store:

  • Visitor
  • Search
  • Product Clicks
  • Add to Cart
  • Orders
  • Product Page View
  • Dwell Time
  • Facets
  • Cart Removal
  • Search Impression

When a visitor browses 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 your 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 helps fetch relevant and personalized products as search results. It also helps in generating detailed reports.

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

How to Integrate?

The conventional way to integrating Unbxd Analytics is simple 2-step process which involves:

  1. Inserting a JavaScript code.
  2. Tracking events.

1. Inserting the JavaScript Code

Your first step is to insert a JavaScript code within the tag of the all the pages in your website. This JavaScript code is responsible for making calls to our servers. The JavaScript code will not affect the page load time as it is loaded asynchronously.

JavaScript Code

<script type="text/javascript">  
  /* * * CONFIGURATION * * */
  var UnbxdSiteName = "<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>: Your Site Key.

You can find your Keys in your an Unbxd Site Search account. If you don’t have an account, sign up with Unbxd Site Search here.

This step is same if you are integrating Unbxd Analytics using our RESTful APIs.

2. Tracking Events

After you have inserted the JavaScript code, your next step is to insert event trackers across your website in order to track the various visitor actions on your website. Unbxd provides dedicated HTML codes for tracking each event. These codes must be inserted in the required site properties.

Event Tracking Parameters

ParameterDescription
SKU_ID or pidThe SKU or uniqueID (UID) of the product. If you have product variants in your catalog, do not use variant ID in place of SKU ID.
PRANK:The rank of a product in the results. Product ranking is done by our search engine based on relevancy.
PRICE:Price of the ordered product.
dwellTime:time spent on the product description page (type long).
QTY:Quantity of the ordered SKU or UID.
pids_list:List of newly loaded PIDs or UIDs (type Array of String) .
Visitors

This event is tracked to identify "first-time" and "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 mins. Once expired, the cookie is reset with new "visitType" value. This means, if a visitor sticks around for more than 30 minutes, he will no longer be "first-time", but a "repeat" visitor.
You do not have to track visitor events separately as the JavaScript code added earlier tracks it out-of-the-box.

The visitor information is stored until the visitor's browser cookies are cleared.

A Search 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 event involves:
  1. Typing the query.
  2. Pressing Enter or Clicking the Search button
  3. .

To track the search event insert the below codes on the:
  • Search box:
  •  <input placeholder="Search" unbxdattr="sq" />
    
  • Submit button:
  • <button type="submit" unbxdattr="sq_bt">Search</button>  
    


    Clicks

    Tracking the products visitors click helps our search engine to understand their preferences over the other products in the search results. The collated click information is then used to render relevant and personalized search results. It is also used for generating popular products. Insert the below code in product containers (`div`) across the site:

     <li unbxdattr="product" unbxdparam_sku="SKU_ID">
    

    You would also need to track products displayed as the search results for a query. The below code must be inserted within the <li> tag for all the search result pages:

     <li unbxdattr="product" unbxdparam_sku="SKU_ID"  unbxdparam_prank="PRANK"></li>
    
    When visitor arrives on a product page from an external source, it is considered as a Click event.

    Cart Additions

    Our analytics engine learns about your visitor’s from tracking the products added to their cart. This helps us rank products better. Inserting the code below on every Add to Cart button in your site would initiate the tracker:

    <input unbxdattr="AddToCart" unbxdparam_sku="SKU_ID">  
    
    Tracking Orders

    The below tag needs to be inserted in the order confirmation/success page. This tag must be added in the li tag for an ordered product:

     <li unbxdattr="order" unbxdparam_sku="SKU_ID" unbxdparam_price="PRICE" unbxdparam_qty="QUANTITY"</li>
    
    When a visitor buys multiple products (SKUs) in a single order, API calls for each order will be fired.

    Tracking Product Page View

    Product Page Views is used to specify the total number visits to the "product detail page" of a product. To track "product page views" configure the below code in your ecommerce store.

     UnbxdAnalyticsConf['pid'] = <pid> 
    
    • pid - uniqueId of the product (type String)
    The "UnbxdAnalyticsConf[]" tag must always be configured before the "unbxdAnalytics.js" gets loaded on your store.

    Tracking Dwell Time

    Dwell time specifies the visitor's duration of stay on a particular product detail page. To track dwell time for a particular product configure the below code in your store:

    UnbxdAnalyticsConf['pid'] = <pid>  
    
    • pid: uniqueId of the product.
    Tracking Facet

    At Unbxd, the more data we capture, more relevant the results would be. That is why tracking facet interaction on a result page becomes essential for building a comprehensive profile for a visitor that helps in fetching relevant results.

    To track the facets on the results listing page configure the following code as instructed:

    UnbxdAnalyticsConf[query]  
    

    <input unbxdparam_facetname="<facet field>" unbxdParam_facetValue="<field value>" checked>  
    
    The above code must be configured for all facet fields on the page. For example,
    <input unbxdparam_facetname="color" unbxdParam_facetValue="red" checked>  
    


    If "UnbxdAnalyticsConf.query" is not set then the the code will check for URL params and key to be looked for will be taken from "search input attr" name.)

    Tracking Cart Removal

    Like "Cart Additions", tracking "cart removal" is also important as it helps us better understand the visitor's field preferences. Configure the following code as instructed to track when visitors remove a product from her/his cart.

    <button unbxdAttr="RemoveFromCart" unbxdParam_sku="<SKU_ID>" unbxdParam_qty="<qty>">  
    
    The above code must be configured on all "cart removal" buttons on the cart page. For example,
    <button unbxdAttr="RemoveFromCart" unbxdParam_sku="<00041>" unbxdParam_qty="<1>">  
    


    Tracking Search Impressions

    Search impressions refer to the event when search results are loaded on a page. This event is tracked to track the different products loaded for a search query. In case of an infinite scroll, search impression will be tracked on every page scroll.

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