This article describes what contexts are and how they are used to define the pages in which you test changes to the design of your digital experience.
Table of Contents
- What is a Context?
- What happens when a visitor matches context targeting criteria?
- Targeting pages and states in your digital experience
- Other uses for Contexts
What is a Context?
A Context refers to the page(s) or state of your digital experience in which you want to test changes to the design. They can also be used to track the flow of visitors through different parts of the funnel.
A context should target anywhere variants may render, for example:
- Distinct pages, like a seasonal campaign landing page
- Page templates, like Product Listing Pages and Product Detail Pages
- States of a page, like those that promo a special offer in certain conditions
- Full funnels, like the checkout steps
- Multiple domains, like affiliate marketing pages that share the templates across multiple sites
These experiences are defined using targeting criteria on a variable group. A variable group used for this purpose is considered a “context.”
What happens when a visitor matches context-targeting criteria?
Rendering variants
If the context contains any variables, a visitor may experience any variants of those variables that are allocated to them in that context.
Tracking behavior
If the context is designated an ‘entry point,’ visitors who match the targeting criteria will be tracked and counted in reporting.
Disable the entry point setting if you do not want to count visitors who match the context criteria before reaching a different page that is an entry point.
For example, you may only want to count visitors who start at a particular point in the customer experience.
Targeting pages and states in your digital experience
Targeting criteria on the context serves as the mechanism to precisely define the page or state in which variants should be rendered. When a visitor’s session matches the defined criteria, they will be able to see their allocated variants in the appropriate context.
URL targeting criteria
In the Web Editor, URL targeting criteria can be defined using a variety of URL pattern matching criteria including simple and regular expression matches.
Read Creating a context to learn more about options in the Web Editor.
Non-URL targeting criteria
When URLs are not a reliable way to distinguish between different pages in your digital experience, you can use the Manager to add custom targeting criteria to the corresponding variable group.
Custom targeting criteria may include:
- HTML page title
- Presence of HTML elements on the page
- Custom data attributes passed to Evolv AI
For more on how to apply non-URL based targeting criteria to variables in the Manager, read: Customizing context criteria in the Manager
Other uses for Contexts
Tracking user flows
Contexts can also used to track which pages visitors experience along their journey. As a visitor matches each context targeting criteria, a record is attributed to their browser session. This user flow data is represented on the Flows page in each project.
Applying common code across variables and variants
Adding CSS and Javascript to a context can also be a useful strategy for applying code to multiple variables.
To understand how code operates within a project, it's essential to grasp the sequence in which it executes:
- 1st – Environment Integrations: These are the first in line, initializing any integrations you have set up for your environment, and run on every pages the snippet is present.
- Note - the project audience is evaluated after integrations run.
- 2nd – Context: Next in the sequence is the Variable Group, where targeting criteria are applied to define which page or pages the variants should affect.
- 3rd – Variant: Finally, the Variant stage executes, wherein the actual changes and tests are implemented.
For more on context-level code, see Adding CSS and Javascript to a context