get_cart_affinity
Co-purchase / market-basket analysis. Given an anchor product (productTitle), returns other products frequently bought with it, ranked by lift. Reports: basket (same-order co-purchase — best for bundles, 'frequently bought together' widgets, post-checkout upsells), lifetime (same-customer across all their orders — best for email flows and longer-horizon recommendations; also returns avgDaysToCoBuy for sequencing). Each pair has support, confidence, lift (>3 strong, 1.5–3 moderate, <1.5 weak), and a verdict. Co-occurrences below minCoOccurrences are suppressed because lift is unstable on small samples.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| limit | No | Number of co-products to return (default: 10, max: 25). | |
| report | Yes | basket = same-order co-purchase; lifetime = same-customer across orders. | |
| _offset | No | Pagination offset. If a response includes _pagination.hasMore=true, use _offset to fetch the next page. | |
| endDate | No | End date (YYYY-MM-DD). Defaults to yesterday (last fully-closed day — today is excluded by default to avoid partial-day totals; pass an explicit endDate to include today). | |
| startDate | No | Start date (YYYY-MM-DD). Defaults to a 30-day window ending yesterday. For lifetime: bounds anchor acquisition; candidate purchases are looked up across the customer's full history. | |
| productTitle | Yes | Anchor product title (case-insensitive substring match). Required. | |
| minCoOccurrences | No | Suppress pairs with fewer than this many co-occurrences (default: 3). Raise to 5–10 for high-volume stores; lower to 2 for low-volume stores or specific anchor products. |