The availability of features may depend on your plan type. Contact your Customer Success Manager if you have any questions.

Dev guideRecipesAPI Reference
Dev guideAPI ReferenceUser GuideLegal TermsGitHubDev CommunityOptimizely AcademySubmit a ticketLog In
Dev guide

Configuration settings

How to configure and customize Optimizely Edge Agent.

👍

Beta

Optimizely Edge Agent is in beta. Apply on the Optimizely beta signup page or contact your Customer Success Manager.

Optimizely Edge Agent is a versatile solution that lets you configure and customize your experimentation and personalization efforts. The agent operates in the following two modes:

  • Edge mode for handling GET requests.
  • Agent mode for handling POST requests.

See the Two modes of Optimizely Edge Agent documentation for more.

Configuration methods

You can configure the Optimizely Edge Agent using three different methods:

  • HTTP Headers – Pass configuration settings as HTTP headers in the request, supported for edge mode (GET requests) and agent mode (POST requests).
  • Query Parameters – Pass configuration settings as query parameters in the request URL, supported for edge mode and agent mode.
  • JSON Body (agent mode only) – Pass configuration settings as a JSON object in the request body, supported for agent mode.

Priority of configuration settings

When Optimizely Edge Agent processes a request, it reads the configuration settings in the following order of priority:

  1. HTTP Headers – The agent first checks for configuration settings in the HTTP headers. If it finds a setting in the headers, that setting takes precedence over the same setting defined in query parameters or the JSON body.
  2. Query Parameters – If it does not find a configuration setting in the HTTP headers, the agent checks the query parameters. If it finds a setting in the query parameters not defined in the headers, it uses that setting.
  3. JSON Body (agent mode only) – If it does not find a configuration setting in the headers or query parameters, the agent looks for it in the JSON body of the request.

By following this order, Optimizely Edge Agent lets you have granular control over the configuration settings so you can override settings at various levels based on their specific requirements.

requestConfig.js module

The requestConfig.js module reads and sets the necessary configuration settings that Optimizely Edge Agent uses to operate. It handles the extraction and parsing of configuration settings from the request's headers, query parameters, and JSON body (in agent mode).

In addition to the standard configuration settings, you can add any custom configuration settings you want to use in your specific implementation. The requestConfig object accessible in every handler and module throughout Optimizely Edge Agent automatically contains these custom settings.

This lets you have flexibility and extensibility to define and utilize their own configuration settings based on their specific requirements. The requestConfig object acts as a centralized repository for all configuration settings, making it convenient to access and use them in various parts of the codebase.

To add custom configuration settings, you can include them in the request's headers, query parameters, or JSON body (in agent mode), following the same format as the standard configuration settings. The requestConfig.js module automatically extracts and parses these custom settings, making them readily available in the requestConfig object.

With this capability, Optimizely Edge Agent lets you tailor the behavior and functionality of your implementation according to your specific needs for customization and adaptability.

The requestConfig.js module performs the following tasks:

  1. Initializes the request configuration based on headers, query parameters, and the JSON body for POST requests in agent mode.
  2. Defines the set of supported query parameters for configuration.
  3. Initializes metadata configuration for logging and debugging purposes.
  4. Initializes configuration settings from HTTP headers.
  5. Initializes configuration settings from URL query parameters.
  6. Loads the request body and initializes configuration settings from it, if the request method is POST and the content type is JSON (agent mode).

By centralizing the configuration handling in the requestConfig.js module, Optimizely Edge Agent ensures consistent and efficient settings management across different modes and request methods.

Configuration settings

The following table provides an overview of the available configuration settings for Optimizely Edge Agent.

SettingDescriptionHeadersQuery ParametersJSON Body
sdkKeyThe datafile SDK key for the Optimizely project.YesYesYes
overrideCacheIndicates whether to override the cache.YesYesYes
overrideVisitorIdIndicates whether to override the visitor ID. Every request generates a new visitor ID. Used for development and testing.YesYesYes
attributesCustom attributes and audience conditions for the visitor.YesNoYes
eventTagsEvent tags for tracking and reporting.YesNoYes
datafileAccessTokenAccess token for retrieving the datafile.YesNoNo
enableOptimizelyHeaderIndicates whether to enable Optimizely Experimentation.YesNoNo
decideOptionsOptions for the decide function.YesNoNo
visitorIdThe visitor ID for the request.YesYesYes
trimmedDecisionsIndicates whether to trim the decisions.YesYesYes
enableFlagsFromKVIndicates whether to enable feature flags from the key-value store.YesNoYes
eventKeyThe event key for tracking and reporting.YesYesYes
datafileFromKVIndicates whether to retrieve the datafile from the key-value store.YesNoYes
enableRespMetadataHeaderIndicates whether to enable response metadata.YesNoNo
setResponseCookiesIndicates whether to set response cookies with bucketing decisions.YesYesYes
setResponseHeadersIndicates whether to set response headers with bucketing decisions.YesYesYes
setRequestHeadersIndicates whether to set request headers with bucketing decisions.YesYesYes
setRequestCookiesIndicates whether to set request cookies with bucketing decisions.YesYesYes
serverModeThe server mode for the agent (Edge or Agent).NoYesNo
flagKeysThe specific flag keys to evaluate.NoYes (multi-valued)Yes
enableResponseMetadataIndicates whether to enable response metadata.YesYesYes
decideAllIndicates whether to evaluate all flag keys.NoYesYes
disableDecisionEventIndicates whether to disable the decision event.NoYesYes
enabledFlagsOnlyIndicates whether to return only enabled flag keys.NoYesYes
includeReasonsIndicates whether to include reasons for flag decisions.NoYesYes
ignoreUserProfileServiceIndicates whether to ignore the user profile service.NoYesYes
excludeVariablesIndicates whether to exclude variables from the response.YesYesYes
forcedDecisionsForced decisions for specific flag keys.NoNoYes