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.
- From the Merchandising Studio homepage, click Visual merchandiser.
- In the search field, enter the keyword query you'd like to set a rule with context for.
- In the “Ranking factors” section, click “Curate this query”.
- In the “Trigger” section, hover over the keyword query to expose the edit/pencil icon. Click it and then toggle “Context” on.
- Enter your context in the field, then click “Apply”. The rule you create consequently will have this context applied to it.
- Load dashboard section: Rules
- Select the correct index
- Click on “New Rule” button and select “Visual Editor”
- Select “Set query condition(s)”
- Enter the query that this rule will affect
- 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 pre-configured by the engineering team in order for you to be able to apply them.
- Click “apply”
- Select the consequence (action) for the rule: Pin items, hide items, boost categories, bury categories or filter results
- Review the effects of the new rule in the UI simulator before saving the rule.
- Load dashboard section: Rules
- Select the correct index
- Click on “New Rule” button and select “Manual Editor”
- Enter the query that this rule will affect
- 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.
- Select the consequences for the rule.
- Optional: Add rule description for clarity and define a timeframe for the promotional campaign.
- Review the rule before saving