Search for Product(s)

When a user initiates a product search within your mobile app, showcasing their interest in finding specific items or information.

import AntsomiRnSDK from '@antsomicorp/antsomirnsdk';

const items: Record<string, any>[] = [];

// Replace the object searchResult, and userData with your object
searchResult.forEach((productDetail) => {
  items.add({
    type: "product",
    id: productDetail.sku,
    name: productDetail.name
  });
});

const event: CDPEvent = {
  en: "product_search_browsing",
  items: items,
  customerProps: {
    customer_id: MD5Hash().generateMd5(userData.email ?? ''),
    name: userData.name
  },
  eventProps: {
    src_search_term: searchResult.keyword
  }
};

await AntsomiRnSDK.track(event);

Last updated