Pathways and Recommendations Pixel Integration - Bloomreach Experience - Open Source CMS

Pathways and Recommendations Pixel Integration

Integrate Core Bloomreach Pixels
  • If you are a new customer, ensure that you have integrated the core Bloomreach pixels. It is mandatory to install the core pixels irrespective of which Bloomreach Search and Merchandising product you are using. To learn about how to install the core Bloomreach pixels, go the Pixel Deployment Page.
  • If you are an existing customer that already has the core Bloomreach Pixels, proceed to the rest of the document.

The pixel is the component that tracks the activities of your customers on your live site. Bloomreach uses customer/user behavior to optimize features dynamically.

For Recommendations, the events that are tracked via the pixel are:

  • Widget View
  • Widget Click and
  • Widget Add-to-Cart (optional)

To integrate the pixel, you must add a Javascript snippet to your code to all the pages, on all the versions- desktop, mobile, and tablet. You can simply add the tracking code snippet to your global footer to ensure it is added everywhere. Different events require different snippets and should be added individually. The events are explained below.

If you are using a Tag Manager to track event, you can setup the Bloomreach pixel without adding any code. To learn how to do this, go to Use a Tag Manager.

Supported Event Tracking Pixels 

The Javascript tracking pixels for Recommendations are tracked for the following customer activity on your live site. Each Javascript tracking pixel is defined by the BrTrk.getTracker().logEvent.

Event

BrTrk.getTracker().logEvent Javascript

Widget View
BrTrk.getTracker().logEvent('widget','widget-view',widget_view_data,true)
Widget Click
BrTrk.getTracker().logEvent('widget','widget-click',widget_data,true) 
Widget Add-to-Cart (optional)
BrTrk.getTracker().logEvent('cart','widget-add',widget_atc_data)

Widget View Event Tracking Pixel

This pixel tracks the impressions of the customer whenever a recommendation widget is viewed by the customer. For every widget that is added to the page, a corresponding widget view pixel has to be fired. To track the view event, install the following Javascript tracking pixel: 

  • Copy-paste the Widget View Event Tracking Snippet given below and install it on all your pages:

View Event Tracking Snippet

var widget_view_data = {}
        widget_view_data.wrid = 'abcd123'
        widget_view_data.wq = 'black dress'
        widget_view_data.wid = 'abc123'
        widget_view_data.wty = 'mlt'
BrTrk.getTracker().logEvent('widget','widget-view',widget_view_data,true)

Widget View Event Tracking Variables

Variable

Data Type

Requirement

Description

Example

widget_data.wrid String Mandatory

The unique ID of the response. This value has to be populated from the API response metadata.widget.rid.

abcd123
widget_view_data.wq String Mandatory The query string used by the customer which returns a widget suggestion. This is optional for non-query widgets. black dress
widget_view_data.wid String Mandatory The widget ID. This is a unique, 6 character alphanumeric value. This value has to be populated from the API response metadata.widget.id. abc123
widget_view_data.wty String Mandatory The type of recommendation widget. This value has to be populated from the API response.This value has to be populated from the API response metadata.widget.type. search,mlt, etc. 

Widget Click Event Tracking Pixel

When a customer clicks on a Recommendation widget, a click event occurs and is tracked by a Javascript tracking pixel. 

To install this pixel:

  • Copy-paste the Widget Click Event Tracking Snippet given below and install it on all your pages:

Click Event Tracking Snippet

var widget_data = {}
    widget_data.wrid = 'abcd123'
    widget_data.wq = 'black dress'
    widget_data.wid = 'abc123'
    widget_data.wty = 'mlt'
    widget_data.item_id = 'pd123'
       BrTrk.getTracker().logEvent('widget','widget-click', widget_data,true)

Widget Click Event Tracking Variables

Variable

Data Type

Requirement

Description

Example

widget_data.item_id Numeric Mandatory The unique ID (PID) of the clicked product. The PID is used from the API call. pd123
widget_data.wrid String Mandatory

The unique ID of the response. This value has to be populated from the API response metadata.widget.rid.

abcd123
widget_view_data.wid String Mandatory The widget ID. This is a unique, 6 character alphanumeric value. This value has to be populated from the API response metadata.widget.id.  abc123
widget_view_data.wq String Mandatory The query string used by the customer which returns a widget suggestion. This is optional for non-query widgets. black dress
widget_view_data.wty String Mandatory The type of recommendation widget. This value has to be populated from the API response metadata.widget.type.  search,mlt,etc. 

 

Widget Direct/Quick Add-to-Cart Event Tracking Pixel (Optional)

This pixel tracks the customer’s activity when the ATC button placed within the widget is clicked. This pixel is optional and should be installed only if you have placed an Add-to-Cart button within a widget. 

To track the add-to-cart event from within the widget, you must install the following Javascript tracking pixel.

An example of the Add To Cart button within a widget is given below: Add-To-Cart pixel

On your product pages, use the Add-To-Cart core pixel documented in Add-To-Cart Pixel section. This is a part of your core Bloomreach pixel integration. 
  • Copy-paste the Widget Add-to-Cart Event Tracking Snippet given below and install it on all your pages:

Add-to-Cart Event Tracking Snippet

var widget_atc_data = {}
        widget_atc_data.wrid = 'abcd123'
        widget_atc_data.wq = 'black dress'
        widget_atc_data.wid = 'abc123'
        widget_atc_data.wty = 'mlt'
        widget_atc_data.item_id = 'id123'
        widget_atc_data.sku = 'sk123'

BrTrk.getTracker().logEvent('cart','widget-add',widget_atc_data)

Add-to-Cart Event Tracking Variables

 

Variable

Data Type

Requirement

Description

Example

widget_data.wrid String Mandatory

The unique ID of the response. This value has to be populated from the API response metadata.widget.rid.

abcd123
widget_view_data.wq String Mandatory The query string used by the customer which returns a widget suggestion. This is optional for non-query widgets. black dress
widget_view_data.wid String Mandatory The widget ID. This is a unique, 6 character alphanumeric value. This value has to be populated from the API response metadata.widget.id. abc123
widget_view_data.wty String Mandatory The type of recommendation widget. This value has to be populated from the API response metadata.widget.type.  search,mlt,etc. 
widget_data.item_id Numeric Mandatory The unique ID (PID) of the product. The PID is used from the API call. id123
widget_atc_data.sku String Optional

Unique SKU id that represents the selected variant of this product (e.g. size M, color blue of a t-shirt). 

If your site does not have SKUs, leave this blank.

sku123

Validating the Pixel

The next step is to validate the pixel you have added. To know more about how to do this, go to Validate the Pixel page.

Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?