Search 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.
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. |
Implement the Search Event code on the Search button. |
Enter an exact product name (or product ID) in the Search Bar. Click the Search Icon or hit Enter to start a Search. |
Implement the Search Event code on the Search button. |
Enter an exact category name (or cat ID) in the Search Bar. |
Implement the Search Event code on the Search button. |
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
Name | Variable | Example | Description |
---|---|---|---|
Tracking Type | type | The type of tracking fire. For events, type=event | |
Group Type | group |
Specifies the event grouping. Must not be empty. For search events, group=suggest |
|
Event Action Type | etype |
Specifies the event's action type. Must not be empty. For search events, etype=submit |
Example requests: