View a markdown version of this page

Function examples - AWS Elemental MediaTailor

Function examples

Before working through these examples, you should be familiar with:

This page provides complete, working function configurations for common use cases. Each example includes the scenario, the full configuration, the function mapping, and an explanation of what happens when the function runs.

Example Scenario description
Example 1: Data enrichment Fetch a LiveRamp identity envelope at session start and store it in player parameters.
Example 2: A/B traffic split Split ad request traffic evenly between two ad decision server URLs for A/B testing.
Example 3: Contextual metadata Query Elemental Inference for IAB content classifications and GARM brand safety signals to enrich ad requests with contextual metadata.
Example 4: Secondary ad server fallback Fetch ads from a secondary ad server when the primary ADS response is short, and append them to the ad list.
Example 5: Origin audience routing Map a viewer's postal code to an audience identifier and send it to the content origin as a manifest query parameter.