š Understanding how data and events are captured for analytics is critical for making informed decisions about optimizing your store's performance. In this article, we'll guide you through how Boost AI Search & Discovery pulls data and tracks user events to provide insights through the Analytics feature.
ā ļø This article works with all versions of Boost AI Search & Discovery. To find out which version of our app your store's current theme is installed with, please follow this article.
How We Pull Data for Analytics
Boost AI Search & Discovery captures data from various sources to provide accurate and comprehensive insights into your storeās performance. Here's an overview of the key data sources:
API Requests
Whenever an end user interacts with the store by performing actions such as searching, filtering, or suggesting products, we pull data from the API. The information captured includes:
Search terms
Filter options
Products displayed in the search results
This data is crucial for understanding how users interact with the search and recommendation features.
Event Tracking
We track specific user interactions with the products displayed on your store, which are rendered based on our APIās response. The key user actions we track are:
View Product: When a user views a product's details.
Quick View: When a user clicks on quick product previews.
Add to Cart: When a user adds a product to their cart.
Buy Now: When a user directly initiates a purchase.
Order Data from Shopify
After a customer checks out, Shopify sends detailed order information to our system. This data includes:
Product IDs
Cart Token
Product Prices
Order IDs
This information allows us to track the performance of products and calculate the total revenue generated from specific actions, such as adding a product to the cart or completing a purchase.
Event Tracking Details
Boostās Analytics uses event tracking to capture user actions and interactions on your store. Below are the key events and how we process the data:
Event Clicks Sent to Our API
When users interact with products, the following events are sent to our API endpoint: https://lambda.mybcapps.com/e
. We use the POST method with specific parameters to track these interactions.
Parameters Used in Event Tracking
Here are the parameters included when tracking user events:
Body Params {
tid: Shopify.shop, // tenant_id (required)
qs: query_string, // query_string is search query (optional)
eid: generateUUID(), // event_id (required)
rid: requestId, // request_id obtained from our API response meta.rid
ct: cartToken, // cart token (required for Add to Cart/Buy Now for revenue tracking, optional for product clicks)
pid: productId, // product_id when clicked or added to cart (optional)
t: new Date().toISOString(), // timestamp when the event occurred (required)
u: userAction, // user action from USER_ACTION list
a: action, // action from ACTION list
r: document.referrer, // referrer URL (optional)
sid: session_id, // session_id from localStorage using the key boostSdSessionId
// (You can use window.boostWidgetIntegration.getSessionId()) (required)
cid: getCustomerId(), // customer_id (optional)
pg: getCurrentPage(), // current page type (optional)
vid: variant_id, // variant_id of the product, if applicable (optional)
}
tid (tenant_id): The unique identifier of your Shopify store (required).
qs (query_string): The search query entered by the user (optional).
eid (event_id): A unique event identifier (required).
rid (request_id): The request ID generated from our API response.
ct (cart_token): The cart token, required for tracking revenue-related actions like Add to Cart and Buy Now (optional for product clicks).
pid (product_id): The product ID for the item clicked or added to the cart (optional).
t (clicked_at): The timestamp when the event occurred (required).
u (user_action): The user action, such as viewing a product or adding it to the cart.
a (action): The action, such as filtering, searching, suggesting, or recommending.
r (referrer): The referrer page (optional).
sid (session_id): The session ID retrieved from localStorage (required).
cid (customer_id): The customerās ID (optional).
pg (current_page): The type of page the user is currently on (optional).
vid (variant_id): The variant ID of the product, if applicable (optional).
User Actions Tracked
Utils variable functions. These will help the data collected from Event Tracking be transmitted correctly for Analytics.
const USER_ACTION = {
VIEW_PRODUCT: 'view_product',
QUICK_VIEW: 'quick_view',
ADD_TO_CART: 'add_to_cart',
BUY_NOW: 'buy_now',
};
const ACTION = {
FILTER: 'filter',
SEARCH: 'search',
SUGGEST: 'suggest',
RECOMMEND: 'recommend',
};
// Function to generate a UUID
function generateUUID() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
const r = (Math.random() * 16) | 0;
const v = c === 'x' ? r : (r & 0x3) | 0x8;
return v.toString(16);
});
}
We categorize user interactions based on the following actions:
VIEW_PRODUCT: When the user views a product's details.
QUICK_VIEW: When the user uses the quick view functionality for a product.
ADD_TO_CART: When the user adds a product to their cart.
BUY_NOW: When the user clicks the Buy Now button.
We also categorize actions based on specific user interactions with search and filter functionality:
FILTER: When a user filters products.
SEARCH: When a user performs a search query.
SUGGEST: When a user engages with suggested products.
RECOMMEND: When recommended products are displayed and interacted with.
If you have any questions or need further assistance, please do not hesitate to contact our dedicated support team at [email protected].