Track Search Events - Bloomreach Experience - Open Source CMS

Track Search Events

If a user types `woven scarf` in the search box and then clicks the search button or hits enter to submit the search, Bloomreach expects a search event pixel to fire that contains information about the search query. The information captured in a search event persists until the next page load happens (deferred) and the next page view pixel is fired. E.g. if the search leads to a Search Results Page, the Search Page View Pixel will send the Search Event information to Bloomreach.

To get started, follow the steps given below:

1. Copy and paste the Search Event Tracking Snippet and install on all of your search buttons. 
2. Map the search event variables in the tracking snippet.
3. Make sure to review the implementation scenarios to ensure that the search event data are sent to Bloomreach.

Search Event Tracking Snippet

var searchData = {};
searchData["q"] = "woven scarf";
searchData["catalogs"] = [{ "name" : "example_en" }];

BrTrk.getTracker().logEvent("suggest", "submit",searchData,{},true);

Search Event Parameters

query

Variable Format Examples Description
q  String Variable Example: woven scarf User's typed search query submitted to search box
catalogs Array of Catalog objects [{ "name" : "example_en" }]

List of all catalogs that are displayed when the search page view loads:

- E.g. if search page loads with 3 tabs - "products","content","videos", all three catalogs should be sent in the search event pixel

 

Implementation Scenarios

Please review each of the following scenarios and implement as it applies to your site.

Scenario

Example

User types "woven scarf" in Search Box and clicks the search button or hits enter to submit the search. 

The search result is displayed on a Search Results Page.

Implement the Search Event code on the Search button.

The Search Page View Pixel that fires on the Search Results Page will automatically send the information captured in the Search Event to Bloomreach.
Make sure that the Search Event Pixel fires before the Search Page View Pixel.

Enter an exact product name (or product ID)  in the Search Bar. Click the Search  Icon or hit Enter to start a Search. 

The search redirects to a Product Page.

Implement the Search Event code on the Search button.

The Product Page View Pixel that fires on the Product Page will automatically send the information captured in the Search Event to Bloomreach. 
Make sure that the Search Event Pixel fires before the Product Page View Pixel.

Enter an exact category name (or cat ID)  in the Search Bar.
Click the Search  Icon or hit Enter to start a Search. 

The search redirects to a Category Page.

Implement the Search Event code on the Search button.

The Category Page View Pixel that fires on the Category Page will automatically send the information captured in the Search Event to Bloomreach. 
Make sure that the Search Event Pixel fires before the Category Page View Pixel.

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?