Create an ad optimization experience

Tailor and deliver server-side ad experiences for different audience segments

Ad optimization allows you to tailor server-side ad experiences for different audiences. Create audience segments from request and media data, then define the advertising behavior that JWX applies when each segment matches.



Prerequisites

ItemDescription
Account entitlementsEntitlements to unlock feature access

Contact your JWX representative to enable ad optimization for your property.
Ad configConfiguration defining when to show ads within content and where ads are sourced

Choose an ad config with ad placements, an ad tag, and break settings that represent the experience you want to deliver or evaluate for your segment.

Learn how to create an ad config.
Bumpers(Optional) Property-level bumper enablement

Bumpers are not required to create an ad optimization experience. However, JWX must enable bumpers for your property before you can configure bumper behavior for audience segments.

Contact your JWX representative to enable bumpers and configure your bumper files.



Create an ad optimization experience

Ad optimization details page


Follow these steps to create an ad optimization experience:

  1. On the Ad insertion page, under the Ad optimization tab, click Create ad optimization. The ad optimization details page appears.

  2. Enter a Name for the experience.

  3. Set up advertising.

    💡

    You can also use the JSON editor to define the ad optimization experience (steps 3–5).

  4. Configure bumpers and stitch mode.

  5. Configure advanced settings.

  6. Click Save. The ad optimization experience appears on the Ad optimization tab, along with its ID.

  7. In the row of the ad optimization, in the ID column, click (copy icon) to copy the ID to your clipboard.

  8. In your SSAI manifest request, add the ID as the value for ad_config_id. This activates the ad optimization experience.

    https://cdn.jwplayer.com/v2/sites/{site_id}/media/{media_id}/ssai.{manifest_extension}?ad_config_id={ad_optimization_id}

The ad optimization experience is now applied to the viewer session. JWX evaluates the request against the configured audience segments and returns the resulting SSAI manifest.



Set up advertising

Follow these steps to set up advertising:

  1. On the Advertising tab, click + Add default. The Add default audience segment panel appears.

  2. Enter a Name for the default segment.

  3. From the dropdown menu, select an Ad config to apply when no advertising audience segment matches.

  4. (Optional) Click Split traffic to distribute the default traffic across multiple ad configs:

    1. Select ad config A and enter its traffic percentage.

    2. Select ad config B and enter its traffic percentage.

    3. (Optional) Click + Add ad config to add additional ad configs.

      💡

      Click Split evenly to adjust all traffic to an equal percentage across the ad configs.

  5. Click Save. The default segment appears under Advertising.

  6. Click + Create audience segment. The Create audience segment panel appears.

  7. Enter a Name for the segment.

  8. Under If all of the following is true, define the condition:

    1. From Select parameter, choose the source of the value. Values include Query, Media, Date & time, Location, Device type, Platform, Browser, and Referrer.

    2. Set the parameter value.

      ParameterSteps
      QueryFollow these steps:
      1. Enter the key to evaluate.
      2. Select a comparison operator.
      3. Enter or select the comparison value.
      MediaFollow these steps:
      1. Enter the key to evaluate.
      2. Select a comparison operator.
      3. Enter or select the comparison value.
      Date & timeFollow these steps:
      1. Select a comparison operator.
      2. Select a date from the calendar dropdown menu.
      3. Select a time from the clock dropdown menu.
      LocationFollow these steps:
      1. Select a comparison operator.
      2. Select a country to target from the dropdown menu.
      Device typeFollow these steps:
      1. Select a comparison operator.
      2. Select a device type to target from the dropdown menu.
      PlatformFollow these steps:
      1. Select a comparison operator.
      2. Select a platform to target from the dropdown menu.
      BrowserFollow these steps:
      1. Select a comparison operator.
      2. Select a browser to target from the dropdown menu.
      ReferrerFollow these steps:
      1. Select a comparison operator.
      2. Enter the request source URL to target in the text box.
    3. (Optional) Click + Add condition and repeat steps 8a–b.

  9. Under Then, select the Ad config to apply to matching requests.

  10. (Optional) Click Split traffic to distribute matching traffic across multiple ad configs. Follow the guidance in steps 4a–c.

  11. Click Save. The segment appears under Advertising.

  12. (Optional) Repeat steps 6–11 to create additional audience segments.

  13. If multiple segments exist, drag the segments into the order JWX should evaluate them. JWX prioritizes segments from top to bottom.

↳ Return to main step 4.



Configure bumpers and stitch mode

Define the bumper or stitching behavior without changing the ad config assigned to the same request.

Bumpers

Follow these steps to configure bumpers:

  1. On the Bumpers and stitch mode tab, in the Bumpers section, click + Create audience segment. The Create audience segment panel appears.
  2. Enter a Name for the segment.
  3. Under If all of the following is true, define the condition:
    1. From Select parameter, choose the source of the value.

    2. Set the parameter value.

      ParameterSteps
      QueryFollow these steps:
      1. Enter the key to evaluate.
      2. Select a comparison operator.
      3. Enter or select the comparison value.
      MediaFollow these steps:
      1. Enter the key to evaluate.
      2. Select a comparison operator.
      3. Enter or select the comparison value.
      Date & timeFollow these steps:
      1. Select a comparison operator.
      2. Select a date from the calendar dropdown menu.
      3. Select a time from the clock dropdown menu.
      LocationFollow these steps:
      1. Select a comparison operator.
      2. Select a country to target from the dropdown menu.
      Device typeFollow these steps:
      1. Select a comparison operator.
      2. Select a device type to target from the dropdown menu.
      PlatformFollow these steps:
      1. Select a comparison operator.
      2. Select a platform to target from the dropdown menu.
      BrowserFollow these steps:
      1. Select a comparison operator.
      2. Select a browser to target from the dropdown menu.
      ReferrerFollow these steps:
      1. Select a comparison operator.
      2. Enter the request source URL to target in the text box.
    3. (Optional) Click + Add condition and repeat steps 3a–b. All conditions must be true for the segment to match.

  4. Under Then, set Bumpers to ON to enable bumpers for matching requests. Keep the default OFF setting to disable them.
  5. Click Save. The segment appears under Bumpers.
  6. (Optional) Repeat steps 1–5 to create additional audience segments for bumpers.
  7. If multiple segments exist, drag the segments into the order JWX should evaluate them. JWX prioritizes segments from top to bottom.

Stitch mode

Follow these steps to configure stitch mode:

  1. On the Bumpers and stitch mode tab, in the Stitch mode section, click + Create audience segment. The Create audience segment panel appears.

  2. Enter a Name for the segment.

  3. Under If all of the following is true, define the condition:

    1. From Select parameter, choose the source of the value.

    2. Set the parameter value.

      ParameterSteps
      QueryFollow these steps:
      1. Enter the key to evaluate.
      2. Select a comparison operator.
      3. Enter or select the comparison value.
      MediaFollow these steps:
      1. Enter the key to evaluate.
      2. Select a comparison operator.
      3. Enter or select the comparison value.
      Date & timeFollow these steps:
      1. Select a comparison operator.
      2. Select a date from the calendar dropdown menu.
      3. Select a time from the clock dropdown menu.
      LocationFollow these steps:
      1. Select a comparison operator.
      2. Select a country to target from the dropdown menu.
      Device typeFollow these steps:
      1. Select a comparison operator.
      2. Select a device type to target from the dropdown menu.
      PlatformFollow these steps:
      1. Select a comparison operator.
      2. Select a platform to target from the dropdown menu.
      BrowserFollow these steps:
      1. Select a comparison operator.
      2. Select a browser to target from the dropdown menu.
      ReferrerFollow these steps:
      1. Select a comparison operator.
      2. Enter the request source URL to target in the text box.
    3. (Optional) Click + Add condition and repeat steps 3a–b. All conditions must be true for the segment to match.

  4. Under Then, select the Stitch mode to apply to matching requests:

    • SSAI: (Non-just-in-time) Ads are stitched for the entire duration of the video-on-demand media.
    • JIT: (Just-in-time) Ads are stitched immediately before the ad break.
  5. Click Save. The segment appears under Stitch mode.

  6. (Optional) Repeat steps 1–5 to create additional audience segments for stitch mode.

  7. If multiple segments exist, drag the segments into the order JWX should evaluate them. JWX prioritizes segments from top to bottom.

↳ Return to main step 5.



Configure advanced settings

The advanced settings allow you to create A/B test assignments for the ad optimization experience.

Follow these steps to configure the settings:

  1. In the top section of the page, click Settings. The Advanced settings page appears.

  2. Under A/B test assignment, select an option to determine how viewers are assigned to an ad config when traffic splits.

    OptionDescription
    DefaultViewers are assigned by user-agent and IP address. Viewers may switch ad configs if their IP changes.

    Follow this step:
    1. Click Default.
    Custom keyViewers are assigned by manifest identifier, such as a device or user ID. Each value consistently maps to the same ad config for reliable experiment results.

    Follow these steps:
    1. Click Custom key.
    2. From the dropdown menu, select a key type (query/, media/, or header/).
    3. In the textbox, enter a key.
    4. (Optional) Click + Add another key and repeat steps 1–3 to add another key.
  3. Click Save. The Advanced settings panel closes.

↳ Return to main step 6.



Define the JSON configuration

In addition to the visual editor, you can use the JSON editor to review or update the entire ad optimization experience.

The ad optimization groups outcomes under three objects:

  • ad_config
  • bumpers
  • stitch_mode

Each parameter contains an ordered segments array. Every segment combines the conditions in rules with one or more outcomes in results.

Plan the configuration

Before defining the JSON, decide how the experience should behave at request time.

QuestionResponse
Which attributes are available?Identify the query parameters, request headers, media metadata, and SSAI context that can be evaluated in the request.
When should JIT or non-JIT stitching be used?Determine whether specific devices, platforms, audiences, or content require a particular stitch mode.
How should traffic be split?Decide whether a segment should use one result or distribute traffic across multiple weighted results.

Having these decisions in place helps you define a clear, predictable configuration.

The following example defines an ad optimization experience that:

  • Uses weights to split traffic for the Example segment between ad configs A and B
  • Uses separate weights in the Default config segment to split unmatched advertising traffic between the same ad configs
  • Enables both bumpers when all query, media, and date-time rules in the bumper segment match
  • Uses just-in-time stitching when the user query parameter equals 1
📘

Learn more.

How is this ad optimization experience evaluated?

When JWX receives an SSAI request, it evaluates the ad optimization experience as follows:

  1. JWX evaluates ad_config, bumpers, and stitch_mode independently.
  2. Within each parameter, JWX evaluates segments in array order, from top to bottom.
  3. A segment matches only when all objects in its rules array evaluate to true. An empty rules array defines an unconditional fallback segment.
  4. JWX selects the highest-priority matching segment for that parameter.
  5. If the selected segment contains multiple results, JWX distributes traffic proportionally according to each result's weight.
  6. JWX applies the selected result's value for that parameter.


Define the JSON configuration

Follow these steps to define the JSON configuration:

  1. At the top of the page, click Edit JSON. The Edit ad optimization in JSON panel appears.
  2. Update the configuration. See the reference below for more information.
  3. Click Save. The JSON editor closes and the visual editor reflects the saved configuration.
JSON sample
{
  "parameters": {
    "ad_config": {
      "segments": [
        {
          "id": "{segment_id_A}",
          "name": "Example segment A",
          "results": [
            {
              "value": "{ad_config_id_A}",
              "weight": 70
            },
            {
              "value": "{ad_config_id_B}",
              "weight": 30
            }
          ],
          "rules": [
            {
              "comparator": "not-equals",
              "lvalue": {
                "key": "example_key",
                "keyspace": "query"
              },
              "rvalue": "0"
            },
            {
              "comparator": "equals",
              "lvalue": {
                "key": "title",
                "keyspace": "media"
              },
              "rvalue": "Example"
            },
            {
              "comparator": "less-than",
              "lvalue": {
                "key": "now",
                "keyspace": "ssai"
              },
              "rvalue": "2027-07-31T13:00:00.000Z"
            }
          ]
        },
        {
          "id": "{segment_id_B}",
          "name": "Default config",
          "results": [
            {
              "value": "{ad_config_id_A}",
              "weight": 75
            },
            {
              "value": "{ad_config_id_B}",
              "weight": 25
            }
          ],
          "rules": []
        }
      ]
    },
    "bumpers": {
      "segments": [
        {
          "id": "{segment_id_B}",
          "name": "Example segment B",
          "results": [
            {
              "value": "both"
            }
          ],
          "rules": [
            {
              "comparator": "not-equals",
              "lvalue": {
                "key": "example_key",
                "keyspace": "query"
              },
              "rvalue": "0"
            },
            {
              "comparator": "equals",
              "lvalue": {
                "key": "producer",
                "keyspace": "media"
              },
              "rvalue": "John Doe"
            },
            {
              "comparator": "less-than",
              "lvalue": {
                "key": "now",
                "keyspace": "ssai"
              },
              "rvalue": "2027-07-01T04:00:00.000Z"
            }
          ]
        }
      ]
    },
    "stitch_mode": {
      "segments": [
        {
          "id": "{segment_id_C}",
          "name": "Example segment C",
          "results": [
            {
              "value": "jit"
            }
          ],
          "rules": [
            {
              "comparator": "equals",
              "lvalue": {
                "key": "user",
                "keyspace": "query"
              },
              "rvalue": "1"
            }
          ]
        }
      ]
    }
  }
}
Top-level configuration
FieldDescription
parameters objectOne or more settings that affect how the ad optimization experience is evaluated

See parameters for more information.

parameters

FieldDescription
ad_config objectContains an ordered segments array that determines which ad config is broadcast to the viewer
bumpers objectContains an ordered segments array that controls whether bumper videos are shown before and after an ad break
stitch_mode objectContains an ordered segments array that controls the method used to stitch ads into the stream

segments

FieldDescription
id stringUnique identifier for the audience segment

The JWX Platform automatically assigns this value to a segment when you create it in the UI.
name stringHuman-readable segment name

The name helps you identify and manage the segment but does not affect evaluation.
results arrayOne or more outcomes that JWX can apply when the segment matches

See results for more information.
rules arrayConditions that must be met at request time for a viewer to receive an ad experience

All rules must evaluate to true for the segment to match. An empty array defines an unconditional fallback segment.

See rules for more information.

results

FieldDescription
value stringDefines the outcome applied when the segment is selected

The allowed value depends on the parameter. See values for more information.
weight integer(Only for advertising) Controls how traffic is split by percentage between multiple results

When an advertising segment has multiple results, JWX compares their weight values and distributes traffic proportionally. This does not apply to bumpers or stitch mode.

NOTE: Weights are relative. For a selected ad_config segment with multiple results, JWX divides each result's weight by the sum of all result weights to determine its traffic share. Choose values that reflect the split appropriate for your configuration. The values in the JSON sample are examples only.

values

ParameterDescription
ad_config stringUnique identifier of the ad config that should be broadcast to the viewer
bumpers stringDefines bumper settings for the associated segment

Possible values:
  • both: Includes a start bumper before the ad break and an end bumper after the ad break.
  • disabled: Skips bumpers.
stitch_mode stringDefines stitch mode for the associated segment

Possible values:
  • ssai: (Non-just-in-time) Ads are stitched for the entire duration of the video-on-demand media.
  • jit: (Just-in-time) Ads are stitched immediately before the ad break.

rules

FieldDescription
comparator stringComparison operator for the lvalue and rvalue

Possible values:
  • equals
  • not-equals
  • contains
  • not-contains
  • greater-than
  • greater-than-equals
  • less-than
  • less-than-equals
lvalue objectRequest or media data attribute that JWX evaluates using the rule's rvalue

See lvalue for more information.
rvalue stringData the lvalue.key must match for the rule to apply

lvalue

FieldDescription
key stringName of the request, media, or SSAI data attribute
keyspace stringSource of the value

You can pass the key from different sources:
  • query: Value passed as a query parameter in the SSAI manifest request
  • header: Value passed in an SSAI request header
  • media: Metadata associated with the requested media item
  • ssai: SSAI context supplied by JWX, such as the current request time through the now key
Learn about the media keyspace
The media keyspace allows you to control the ad load based on the requested media item's metadata. You can reference the following fields:
  • media/title
  • media/description
  • media/duration
  • media/genre
  • media/{custom-parameter}
🚧

Use lowercase field names.

Available media keys depend on the metadata populated for the requested media item. media/duration uses the duration calculated from the analyzed manifest, regardless of the duration stored in the media metadata. Media sources, source overrides, images, and tracks cannot be used as keys.

FAQ

How do date and time conditions work?

When a date and time are applied, the segment is eligible only while the rule evaluates to true. After the timestamp condition expires:

  • The rule no longer matches.
  • The segment is excluded from evaluation.
  • JWX continues to the next matching segment or the unconditional fallback segment.

The ad optimization experience does not fail or stop working. JWX evaluates the remaining applicable segments.




Did this page help you?
© 2007- Longtail Ad Solutions, Inc.