Show Menu
TOPICS×

Normalize rules

The normalize rule defines a URL transformation to apply to a source creative URL obtained from a VAST/VMAP response.
Table 2: The normalize rule has the following attributes and possible values:
Key Type Values Description
type String normalize The value must always be normalize .
item String host Currently only host is supported. This attribute must be present when matches and values attributes are defined.
matches Possible values:
  • eq - equals
  • ne - not equals
  • co - contains
  • nc - not contains
  • sw - starts with
  • ew - ends with
values Array TVSDK will use the matches attribute on the item of the source creative and match against the values defined in this array.
find regex A regular expression to apply on the source creative URL to match.
replace regex A regular expression to apply on the source creative URL to replace based on the match.
{
    "ads": {
        "rules": {
            "default": [
                {
                ...
                }
                {
                    "
<b>type</b>": "
<b>normalize</b>",
                    "
<b>item</b>": "host",
                    "
<b>matches</b>": "ew",
                    "
<b>values</b>": [
                        "redirector.gvt1.com"
                    ],
                    "
<b>find</b>": "videoplayback/(.*?)/expire/.*?/(.*?)/signature/.*?/",
                    "
<b>replace</b>": "videoplayback/$1/expire//$2/signature//"
                }                
            ]
        }
    }
}