Confidence
  • Documentation
  • Blog
  • Bootcamp
  • Status
  • Confidence Bootcamp
    • My learning
    • Intro to experimentation
      • Introduction
      • Lesson 1: Why you should experiment
      • Lesson 2: Experiment hypothesis
      • Lesson 3: Success and guardrail metrics
      • Lesson 4: Success metrics
      • Lesson 5: Set up your experiment
      • Lesson 6: Calculation frequency
      • Lesson 7: Target audience
      • Lesson 8: Sample size
      • Lesson 9: Quality assurance
      • Lesson 10: Run your experiment
      • Lesson 11: Evaluate your experiment and make a decision
      • Lesson 12: A/B tests and rollouts
      • Course wrap up
    • Intro to metrics
      • Introduction
      • Lesson 1: What is a metric?
      • Lesson 2: Metric roles
      • Lesson 3: Time considerations
      • Lesson 4: Capturing behavior
      • Lesson 5: Strategic metrics
      • Lesson 6: Interpretability
      • Lesson 7: Feasibility and sensitivity
      • Lesson 8: Variance reduction
      • Lesson 9: Select metrics
      • Lesson 10: Segment-level analysis
      • Course wrap up
    • Scientific product development
      • Introduction
      • Lesson 1: Why you should experiment
      • Lesson 2: The scientific method
      • Lesson 3: Randomized controlled trials
      • Lesson 4: Experiment hypothesis
      • Lesson 5: Case study
        • Case study
        • Answers to case study
      • Lesson 6: Why do we need statistics?
      • Lesson 7: Success metrics
      • Lesson 8: Detectable effects and sample size
      • Lesson 9: Make a decision
      • Course wrap up
    • A primer on hypothesis testing
      • Introduction
      • Lesson 1: Introduction to hypothesis testing
      • Lesson 2: True vs estimated effects
      • Lesson 3: Sampling distribution of the difference-in-means estimator
      • Lesson 4: Z-tests and how to reject the null hypothesis
      • Lesson 5: False postive rate and alpha
      • Lesson 6: True positive rate, MDE, and power
      • Course wrap up
    • Intro to Feature Flags
      • Introduction
      • Lesson 1: What is a feature flag?
      • Lesson 2: Lifecycle of a feature flag
      • Lesson 3: Clients
      • Lesson 4: Evaluation context and targeting
    • Sample size calculation - I
      • Introduction
      • Lesson 1: What is the required sample size?
      • Lesson 2: Alpha and power
      • Lesson 3: Baseline mean and variance
      • Lesson 4: Sample size playground - I
    • Sample size calculation - II
      • Introduction
      • Lesson 1: Multi-metric decision making
      • Lesson 2: Number of success metrics
      • Lesson 3: Number of guardrail metrics
      • Lesson 4: Number of comparisons
      • Lesson 5: Sample size playground - II
    • Sample size calculation - III
      • Introduction
      • Lesson 1: Binary metrics
      • Lesson 2: Treatment group proportions
      • Lesson 3: Variance reduction
      • Lesson 4: Sequential testing and sample size
      • Lesson 5: Sample size playground - III
    • Advance your experimentation
      • Introduction
      • Lesson 1: Guardrail metrics with non-inferiority margins
      • Lesson 2: Choose evaluation frequency
      • Lesson 3: Metrics' roles in experiments
      • Lesson 4: Cumulative holdback evaluations
    • Experimentation culture
      • Introduction
      • Lesson 1: Onboarding into experimentation
      • Lesson 2: Empowering experimentation champions
      • Lesson 3: Sustaining the experimentation culture
    • Videos

Lesson 4: Evaluation Context and Targeting

Summary

You can give users flag values conditioned on their context. By sending in context with the flag resolve call, the feature flag resolver can use this context and have conditional rules. For example, only users in the US gets a certain experience.

What is the evaluation context?

Context is data relevant to your users that you are interested in targeting your experiments on. It can be as generic as their country or as granular as the amount of times they refresh the landing page. You have the power to collect as much or as little data you want - but what is the suggested approach?

The following video provides a quick overview of how the evaluation context is related to targeting.

The current evaluation context is an integral component in the system and is part of many SDK calls - so be aware that including too much data in a context could potentially lead to increased latency. Work with generic structures that can be reused for targeting across different experiments to minimize the size of your context.

Automatic data collection

Some SDKs allow you to automatically collect certain device data:

  • Device manufacturer and model
  • Application version
  • Custom data that you configure to be automatically collected in your application
In Confidence

Confidence SDKs support automatic collection of device data (manufacturer, model, application version, and custom data you configure) out of the box.

Targeting with context

When you're done setting up your context, you're ready to use it for targeting. In your A/B test or rollout, you can find the relevant data for targeting, such as country, visitor_id, etc. Keep in mind that to mix and match contexts from different systems (mobile, web, backend), you need to ensure that the context is available for all parts of your application where the flag in your experiment is resolved.

Frontend vs. backend context

Frontend apps often have a single user that uses the application. For this reason, a 'static context' paradigm is often applied to frontend SDKs. This means that the contextual data collected in the SDK is static and will stay in memory throughout the application lifecycle until actively being changed or removed through the SDK API.

Backend apps/services on the other hand can serve thousands of different end users during the same second, so in this case, a 'dynamic context' paradigm fits better. The dynamic context paradigm favors volatile context values that will only be used for that split second in which your backend service caters to the end user's request.

In Confidence

In the Confidence SDKs, frontend clients use a static context paradigm and backend SDKs use a dynamic context paradigm. Backend SDKs also have support for longer-living context data that is contextual to the actual backend application (for example, in which geographic region it exists).

Context updates and flag re-evaluation

Frontend clients automatically fetch new flag values when a context value is added, removed or changed. This is because flag values may depend on that specific context value in its rules setup. For example, targeting criteria for an experiment may include user information which is only available after the user has been logged in. The act of logging in would then enable the application to add user information to the context and the SDK will then fetch new flag values.

Certain care should be taken when working in frontend environments and adding values that are volatile (likely to change very often). Since every context change triggers a fetch, we recommend against having volatile values in the context for performance reasons. An extreme example of this would be to continuously add the mouse location to the context.

Context and data integrity

The context is data maintained by the client, and it should at all times reflect truths about the user and/or its device. Which country is the user registered in, but also which country is the user's device currently accessing your app from. Which locale has the user selected.

Reader exercise

What is the purpose of evaluation context in feature flagging?

Reader exercise

Why is it important to be mindful of the amount of data stored in the context?

Was this page helpful?

PreviousLesson 3: Clients
NextIntroduction

© Copyright 2026. All rights reserved.

Follow us on TwitterFollow us on GitHub

On this page

  1. What is the evaluation context?

  2. Automatic data collection

  3. Targeting with context

  4. Frontend vs. backend context

  5. Context updates and flag re-evaluation

  6. Context and data integrity