InterstitialMacroValueProvider

A callback used for dynamically providing values for macros in tracking URLs. This callback is invoked for each macro present in a URI before sending the HTTP request.

Macro names are considered case sensitive. The values provided by this function are URL encoded, before inserted in the respective URIs.

The following macros will be filled by default if not overridden:

  • CACHEBUSTING - A random 8 character numeric string

  • TIMESTAMP - The current timestamp in ISO 8601 format

  • ERRORCODE - The error code when applicable

Example:

val vastMacroValueProvider = VastMacroValueProvider { macro ->
when (macro.name) {
// Setting or overriding values
"CUSTOMMACRO" -> listOf("customValue")
"PLAYHEADPOSITION" -> listOf("0.5")
// Adding an additional value to the existing one
"EXTEND" -> (macro.values ?: emptyList()) + "another value"
// Unset the value
"UNSET" -> emptyList()
else -> macro.values
}
}

Functions

Link copied to clipboard

Provides the macro values for the given macro.