Skip to main content

What are Strategies?

Strategies are Aftersell’s rules-based experience and product recommendation engine. An individual Strategy is a collection of targeting rules that evaluate shopper context (products in cart, customer attributes, UTM parameters, and more) and return fully enriched product recommendations in real time. Unlike static recommendation widgets, Strategies give you full control over which products are shown to which shoppers and when. You can use it to power upsell carousels, cross-sell blocks, post-purchase offers, or any custom experience on a Shopify store.

How it works

  1. You create a Strategy — a strategy containing one or more rules, each with triggers (predicates) and a set of products to recommend when those triggers match.
  2. Your storefront sends context — when a page loads or a cart updates, your storefront sends the current product, cart, customer, and session data to the Strategies API.
  3. The engine evaluates — Aftersell’s rules engine evaluates every rule in the strategy against the provided context and returns fully enriched products with titles, prices, images, variants, and availability.
  4. You render the results — the API response contains everything you need to display recommendations directly. No additional Shopify API calls are required.

Key concepts

Strategy — A named collection of rules that are evaluated together. Each strategy has a unique ID (a 24-character hex string) that you reference when calling the API. Rule — A single trigger-action pair within a strategy. A rule defines when it should match (e.g., “cart contains a product tagged summer”) then the cooresponding experince to render. Predicate — A trigger attached to a rule. Predicates can target product attributes, cart properties, customer data, session/UTM parameters, and product metafields. Catch all — A special rule that fires automatically when no other rule in the Strategy matches. It has no triggers and is always the final step of evaluation. When enabled, it ensures the recommendation slot is never empty and can be configured with any action type available to regular rules. Key-value actions — Rules can emit arbitrary key-value data (e.g., promotional info) alongside product recommendations. These are returned in the meta.data field of the API response.

Getting Started

Prerequisites

  • An active Shopify store with the Aftersell app installed.
  • Access to the Aftersell dashboard (you’ll create your Strategies and generate API keys here).

Step 1: Generate your API key

API keys are scoped to a single shop and are required for all Strategy API requests.
  1. Log in to the Aftersell dashboard.
  2. Navigate to Settings in the left sidebar.
  3. Open Strategies.
  4. Click Generate API Key.
  5. Copy the key immediately — it is shown only once and cannot be retrieved later. Only a one-way hash is stored.
Store your API key securely. The plaintext key is returned once at generation time. If you lose it, you’ll need to generate a new one.

Step 2: Create your first Strategy

You can build Strategies entirely through the Aftersell UI — no code required. See Building Strategies In-App for a walkthrough.

Step 3: Integrate with your storefront

Once you have a Strategy and an API key, you can call the Evaluate endpoint from your storefront to fetch recommendations.