Developer Docs
  • Welcome
  • Frontend API
  • Quick Start
  • Integration Guide
  • Examples
    • Plain JavaScript
    • JavaScript ES modules
  • Recommend API
    • Functions
    • Types
  • Analytics API
Powered by GitBook
On this page
  • IRecommendationProps
  • ISegment
  • IRecommendationResponse
  • IRecommendationItem
  • IPriceRange
  • IPrice
  • IVariant
  • IVariantOption
  • IImage
  • IProductInteractionProps

Was this helpful?

  1. Recommend API

Types

IRecommendationProps

interface IRecommendationProps {
  // unique site identifier provided by Obviyo
  siteId: string;
  // recipe identifier provided in Obviyo App
  qualifiedName: string;
  // master id of currently viewed item (generally sent on pdp)
  item?: string;
  // unique visitor id generated by ecommerce platform
  ecommerceId?: string;
  // used for recipes that require additional items, variable depending on 
  // scenarios; see specific scenarios for details (e.g. ids of items in cart, 
  // ids of items purchased)
  items?: string[];
  // used in filtering to limit response to set of provided categories
  catIds?: string[];
  // used in filtering to limit response to set of provided tags
  tags?: string[];
  // used to provide contextual visitor data to algorithms
  segs?: ISegment[];
  // used for testing, if specified returns a set of preview products
  preview?: boolean;
  // specify a different number of results to return (default is 25)
  numResults?: number;
}

ISegment

interface ISegment {
  // form-factor
  ff?: "desktop"|"mobile";
  // arrival page class
  apc?: "home"|"category"|"pdp"|"search"|"cart"|"checkout"|"account"|"confirm"
}

IRecommendationResponse

interface IRecommendationResponse {
  items: IRecommendationItem[];
  // recommendation results id used to help train model, should be passed in 
  // "click" type product interactions, see $reportProductInteraction function
  rid: string;
}

IRecommendationItem

interface IRecommendationItem {
  // shopify product graphql id
  id: string;
  // id to report in product interactions
  productId: string;
  title: string;
  priceRange: IPriceRange;
  variants: IVariant;
  featuredImage: IImage;
  onlineStoreUrl: string;
  onlineStorePreviewUrl: string;
  tracksInventory: boolean;
  totalInventory: number;
  vendor: string; 
}

IPriceRange

interface IPriceRange {
  maxVariantPrice: IPrice;
  minVariantPrice: IPrice;
}

IPrice

interface IPrice {
  amount: string;
  currencyCode: string;
}

IVariant

interface IVariant {
  id: string;
  title: string;
  availableForSale: boolean;
  inventoryPolicy: "CONTINUE"|"DENY";
  inventoryQuantity: number;
  selectedOptions: IVariantOption;
  compareAtPrice: string;
  price: string;
}

IVariantOption

interface IVariantOption {
  name: string;
  value: string;
}

IImage

interface IImage {
  originalSrc: string;
}

IProductInteractionProps

interface IProductInteractionProps {
  // product master id   
  item: string;
  type: "viewed"|"clicked"|"addedToCart"|"purchased";
  siteId: string;
  ecommerceId?: string;
  segs: ISegment;
  // only needed for "clicked" type
  rid?: string;
  
}
PreviousFunctionsNextAnalytics API

Last updated 3 years ago

Was this helpful?