Search
Covers the full lifecycle of a user's search interaction, from the initial query through results, impressions, widget views, and product clicks.
Covers the full lifecycle of a user’s search interaction, from the initial query through results, impressions, widget views, and product clicks. Events are split into Before Search (pre-results) and After Search (post-results) phases, plus Searchandising for merchandised search results.
Requests:
- Before Search — fires when the user types a query into the search box before results are shown (
name: "SEARCH",type: "instant", emptyquery). - Before Search Impression — fires when the Before Search widget becomes visible (
name: "INTERACTION",type: "impression",instanceId: "BEFORE_SEARCH"). - Before Search Widget View — fires when the Before Search widget is rendered in the viewport (
type: "widget-view",instanceId: "BEFORE_SEARCH"). - Before Search Product Click — fires when a user clicks a product in the Before Search results (
type: "search",instanceId: "bs_product",interactionId: {productId}). - After Search — fires when the user submits a search query and results are returned (
name: "SEARCH",type: "instant",query: "exampleQuery"). - After Search Impression — fires when an After Search widget becomes visible in the viewport (
type: "impression"). - After Search Widget View — fires when the After Search widget is rendered (
type: "widget-view",instanceId: "SEARCH"). - After Search Product Click — fires when a user clicks a product in the After Search results (
type: "search",instanceId: "product",interactionId: {productId}, includesparams.term). - Basket Add (search context) — a Basket Add event sent in the context of a search interaction.
- Searchandising — fires a faceted search event for Searchandising campaigns (
name: "SEARCH",type: "faceted"). Supportsordering,filters, andtriggerfields for sorting, filtering, and trigger type (keyword,page, orfilter). - Searchandising Click — fires when a user clicks a product within a Searchandising result set (
type: "search",instanceId: "searchandisingInstanceId", includesparams.term).
Before Search
Section titled “Before Search”Add Events API
Section titled “Add Events API”This endpoint allows you to track various user events within your application. By sending a POST request to the specified URL, you can log events such as searches performed by users, which can be useful for analytics and improving user experience.
Request
Section titled “Request”URL:
https://{dataCenterUrl}.segmentify.com/add/events/v1.json?apiKey={apikey}
Method:
POST
Request Body:
The request body should be a JSON object with the following parameters:
-
name (string): The name of the event being tracked (e.g., “SEARCH”).
-
userId (string): A unique identifier for the user performing the event.
-
sessionId (string): A unique identifier for the user’s session.
-
testMode (string): Indicates whether the event is being logged in test mode (e.g., “false”).
-
device (string): The type of device being used (e.g., mobile, desktop).
-
os (string): The operating system of the device (e.g., “ANDROID”).
-
lang (string): The language preference of the user.
-
currency (string): The currency used in the transaction or event.
-
region (string): The geographical region of the user (can be empty).
-
query (string): The search query entered by the user (can be empty).
-
type (string): The type of event (e.g., “instant”).
Response
Section titled “Response”The response from this endpoint will typically include a confirmation of the event logging status, along with any relevant metadata. The exact structure of the response may vary, but it generally indicates whether the event was successfully recorded or if there were any errors.
Ensure that all required parameters are included in the request body to avoid errors and ensure successful event tracking.
Example body
{ "name": "SEARCH", "userId": "1234567890123456789", "sessionId": "9876543210987654321", "testMode": "false", "device": "PC", "os": "ANDROID", "lang": "EN", "currency": "EUR", "region": "", "query": "", "type": "instant"}Before Search Impression
Section titled “Before Search Impression”Example body
{ "name": "INTERACTION", "userId": "1234567890123456789", "sessionId": "9876543210987654321", "testMode": "false", "device": "PC", "os": "ANDROID", "referrer": "", "lang": "EN", "currency": "EUR", "region": "", "instanceId": "BEFORE_SEARCH", "interactionId": "static", "type": "impression"}Before Search Widget View
Section titled “Before Search Widget View”Example body
{ "name": "INTERACTION", "userId": "1234567890123456789", "sessionId": "9876543210987654321", "testMode": "false", "device": "PC", "os": "ANDROID", "referrer": "", "lang": "EN", "currency": "EUR", "region": "", "instanceId": "BEFORE_SEARCH", "interactionId": "static", "type": "widget-view"}Before Search Product Click
Section titled “Before Search Product Click”Example body
{ "name": "INTERACTION", "userId": "1234567890123456789", "sessionId": "9876543210987654321", "testMode": "false", "device": "PC", "os": "ANDROID", "referrer": "", "lang": "EN", "currency": "EUR", "region": "", "instanceId": "bs_product", "interactionId": "PRODUCT_ID", "type": "search"}After Search
Section titled “After Search”Example body
{ "name": "SEARCH", "userId": "1234567890123456789", "sessionId": "9876543210987654321", "testMode": "false", "device": "PC", "os": "ANDROID", "referrer": "", "lang": "EN", "currency": "EUR", "region": "", "query": "exampleQuery", "type": "instant"}After Search Impression
Section titled “After Search Impression”Example body
{ "name": "INTERACTION", "userId": "1234567890123456789", "sessionId": "9876543210987654321", "testMode": "false", "device": "PC", "os": "ANDROID", "referrer": "", "lang": "EN", "currency": "EUR", "region": "", "instanceId": "SEARCH", "interactionId": "static", "type": "impression"}After Search Widget View
Section titled “After Search Widget View”Example body
{ "name": "INTERACTION", "userId": "1234567890123456789", "sessionId": "9876543210987654321", "testMode": "false", "device": "PC", "os": "ANDROID", "referrer": "", "lang": "EN", "currency": "EUR", "region": "", "instanceId": "SEARCH", "interactionId": "static", "type": "widget-view"}After Search Product Click
Section titled “After Search Product Click”Example body
{ "name": "INTERACTION", "userId": "1234567890123456789", "sessionId": "9876543210987654321", "testMode": "false", "device": "PC", "os": "ANDROID", "params": { "term": "exampleQuery" }, "referrer": "", "lang": "EN", "currency": "EUR", "region": "", "instanceId": "product", "interactionId": "PRODUCT_ID", "type": "search"}Basket Add
Section titled “Basket Add”Example body
{ "name": "BASKET_OPERATIONS", "userId": "1234567890123456789", "sessionId": "323232", "testMode": "false", "device": "ANDROID", "nextPage": false, "params": {}, "os": "ANDROID", "lang": "TR", "currency": "TRY", "productId": "T59008765Y0", "basketId": "basket_1234567890123456789", "step": "add", "price": "1999.95", "quantity": 1}Searchandising
Section titled “Searchandising”Example body
{ "name": "SEARCH", "query": "red sneakers", "sessionId": "9876543210987654321", "device": "PC", "userId": "1234567890123456789", "lang": "EN", "testMode": "true", "email": "user@example.com", "ordering": { "page": "1", "sort": "PRICE_ASC" }, "trigger": "keyword", "type": "faceted", "filters": [ { "facet": "brand", "values": [ "Acme" ] } ]}Searchandising Click
Section titled “Searchandising Click”Example body
{ "name": "INTERACTION", "userId": "1234567890123456789", "sessionId": "9876543210987654321", "testMode": "false", "device": "PC", "os": "ANDROID", "params": { "term": "exampleQuery" }, "lang": "EN", "currency": "EUR", "region": "", "instanceId": "searchandisingInstanceId", "interactionId": "PRODUCT_ID", "type": "search"}