Analytics

Search analytics can provide valuable insights into user behavior and preferences, which can be used to optimize search functionality and improve the overall user experience.

Zevi AI

Metrics API

Action Items:

  1. Call an endpoint to obtain a session ID and keep it consistent during the entire session.
  2. Include the session ID in the arguments when calling the search API.
  3. Receive the search response and take note of the search identifier returned by the API.
  4. Use the POST API to transmit the data along with the session ID and search identifier.
Zevi AI

Session API

What is a session ID?

A session ID (session identifier) is a unique, randomly generated alphanumeric string that is assigned to a user session when they first access a website or web application. It is typically stored in a cookie or in the URL, and is used to identify the user during their session.

Session IDs are used to maintain stateful information about a user's interaction with a website or application, such as their login status, preferences, and shopping cart contents. They allow the server to associate all of the user's requests with the same session, so that it can provide analytical data.

Whenever a user session is starting, please call this API and get Search Session ID from our servers, and keep it consistent throughout that particular user session.

Sample Request :
curl --location --request GET 'https://api.zevi.ai/2023-01/sessionIdentifier?store_name={client}'
Sample Response :
{ "session_identifier": "ewogICAgInNlc3Npb25faWQiOiAiVFAySDhUNDE2NTg1NTc0OTQuMzIzODIiLAogICAgImJ1Y2tldCI6ICJDQVRBTE9HTU9ERTpMRVhJQ0FMIgp9" }

Modifications in the Search API

curl --location --request GET 'https://api.zevi.ai/2023-01/search/?limit=25&usecache=False&store={client}&q=hair%20growth&**session_id**=ewogICAgInNlYXJjaF9pZCI6ICIwS0VLOThTMTY1ODIwNDI0My42NjU0Mzc1IiwKICAgICJidWNrZXQiOiAiQ0FUQUxPR01PREU6T1BFTiIKfQ=='
Note : session_id has been added to search request

No change in response structure, you will receive searchIdentifier as well from our end to be added in the metric API

Metric API

Append the respective sessionIdentifier and searchIdentifier, returned by the Search API, while calling the below API for every product click performed by the user.

curl --location --request POST 'https://api.zevi.ai/2023-01/metrics/add_search_event' \ --header 'Content-Type: application/json' \ --data-raw '{ "query":"oil", "product_id":"product ID", #Product ID of product being clicked on "rank":rank #Search Rank of the product, "store_name":"{client}", "searchIdentifier":"ewogICAgInNlYXJjaF9pZCI6ICJUTzE1MDc2MTY1ODIxMDg1OS41MDU3NDMzIgp9", "sessionIdentifier":"ewogICAgInNlc3Npb25faWQiOiAiRjZUMzQ1RTE2NTgyMTEzOTkuMTU5MDkyNyIsCiAgICAiYnVja2V0IjogIkNBVEFMT0dNT0RFOkxFWElDQUwiCn0", "timestamp": timestamp }'
Note : searchIdentifier and sessionIdentifier have been added to response structure