Search Event Pixel

❗️

Events always occur on a page view, so you must pass the associated page view pixel information together with the event pixel.

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.

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

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

Search Event Parameters

query

VariableFormatExamplesDescription
qStringVariable Example: woven scarfUser's typed search query submitted to search box
catalogsArray 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.

ScenarioExample
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.

Native App Implementation

You cannclude the Global View variables and the following variables. For details on the native app implementation format, refer to the Non-JS Environment section in the Getting Started page. 

  • type
  • q (see above)
  • group
  • etype
NameVariableExampleDescription
Tracking TypetypeThe type of tracking fire. For events, type=event
Group TypegroupSpecifies the event grouping. Must not be empty.

For search events, group=suggest
Event Action TypeetypeSpecifies the event's action type. Must not be empty.

For search events, etype=submit

Example requests:

https://p.brsrvr.com/pix.gif?
acct_id=6702
&cookie2=uid%3D1e7724c751a3f6e6241018d150144832e7528383%3Av%3Dapp%3Ats%3D0%3Ahc%3D1
&rand=86838131966165760
&type=event
&title=Blue%20Lace%20Dress
&url=http%3A%2F%2Fmerchantname.app%2Fproduct%2Fblue%2520lace%2520dress
&ref=http%3A%2F%2Fmerchantname.app%2Fcategory%2Fdresses
&group=suggest
&etype=submit
&ptype=product
&prod_id=prod1234
&prod_name=Blue%20Lace%20Dress
sku=123-45
&q=blue%20lace%20dress

Did this page help you?