Skip to main content

Generate a Nonce for Your Ad Request

A nonce is a single encrypted string generated by PAL via the NonceLoader. The PAL SDK requires each new stream request to be accompanied by a newly generated nonce. However, nonces may be reused for multiple ad requests within the same stream.

Initialize the PAL Plugin​

To initialize the PAL Plugin, add pal attribute to the plugins object in your config. To see more details about configuration, please check out PAL Plugin

//Create PAL configuration
let palConfig = PALPluginConfiguration(
enabled: true,
ppid: "PPID",
descriptionUrl: "DESCRIPTION_URL",
forceLimitedAds: false,
directedForChildOrUnknownAge: false,
disableLimitedAdsStorage: false,
disableFirstPartyIdentifiers: false
)
//Apply PAL configs to LuraConfig
luraConfig.plugins = LuraPlugins(palConfig : palConfig)

Using the PAL Nonce​

LuraPlayer automatically fills the reserved macro LURA_PAL_NONCE in URL's under the ads parameter. Check out macros for more details.

//Create PAL configuration
let palConfig = PALPluginConfiguration(
enabled: true,
ppid: "PPID",
descriptionUrl: "DESCRIPTION_URL",
forceLimitedAds: false,
directedForChildOrUnknownAge: false,
disableLimitedAdsStorage: false,
disableFirstPartyIdentifiers: false
)
//Apply PAL configs to LuraConfig
luraConfig.plugins = LuraPlugins(palConfig : palConfig)
luraConfig.ads.clientSide.generic.breaks = [
{
url: "https://www.example.com?correlator=[LURA_CORRELATOR]&nonce=[LURA_PAL_NONCE]",
offset: "preroll",
},
]