Resources Merchandising Actions

Leveraging Rules Context

A context controls whether a Rule should apply all the time, or only in some specific situations.

When to use Rule context?

A Rule Context is a 'tag' that you send Algolia to tell us more about the Search, Browse or Recommend requests your customers make. You can then build rules to tailor the products shown accordingly. This makes most sense with examples.

Example 1:
Your website sends a context “new” or “returning” to Algolia to distinguish between existing customers and new visitors. You then create rules to promote products you know are popular with new customers.

Example 2:
Your website sends a context to distinguish between desktop and mobile users, allowing you to merchandise collection pages differently.

Example 3:
Customers finding your store from a marketing campaign for a particular brand have a context added so that the brand is featured more heavily in their searches and as they browse

NOTE: Before you can create rules using contexts your engineering team will need to configure your store to send them, you can send them this link for more information.

  1. Load dashboard section: Rules 
  2. Select the correct index
  3. Click on “New Rule” button and select “Visual Editor”
    Manual Editor 1
  4. Select “Set query condition(s)”
  5. Enter the query that this rule will affect
  6. Apply the context
    • Common use-cases for context are device (mobile, desktop, etc.), language (French, English, etc.), or country. Another typical context is category pages, such as pages dedicated to Apple products or Android phones.
    • Note: the context labels need to be per-configured by the engineering team in order for you to be able to apply them.
  7. Click “apply”
    Manual Editor 2
  8. Select the consequence (action) for the rule: Pin items, hide items, boost categories, bury categories or filter results
    Manual Editor 3
  9. Review the effects of the new rule in the UI simulator before saving the rule.
  1. Load dashboard section: Rules 
  2. Select the correct index
  3. Click on “New Rule” button and select “Manual Editor”
    Manual Editor 1
  4. Enter the query that this rule will affect
  5. Apply the context
    • Common use-cases for context are device (mobile, desktop, etc.), language (French, English, etc.), or country. Another typical context is category pages, such as pages dedicated to Apple products or Android phones.
    • Note: the context labels need to be per-configured by the engineering team in order for you to be able to apply them.
    Manual Editor 2
  6. Select the consequences for the rule.
  7. Optional: Add rule description for clarity and define a timeframe for the promotional campaign.
    Manual Editor 3
  8. Review the rule before saving
Configuring Analytics TagsAnalytics