Skip to main content

Google PAL

The fl-ads-pal library integrates with Google PAL library to enable publishers make a direct call to monetize web Applications.

Create PAL Session

Create a PALSession for every playback. The events for the playback can be captured through this session.

PropertyTypeRequiredDescription
allowStoragebooleantrueWhether PAL has purpose 1 consent to use identifiers and storage. The value needs to be determined by integrating with CMP (Consent Management Provider). This is set to false by default. If specified as true, PAL has consent from the user to use information like cookies, device IDs and advertising IDs. This value needs to be set to be IAB TCFv2 (Transparency and Consent Framework) compliant.
loggerLoggerfalseLogs the information based on the log level. (One can create a Logger using fl-foundation library)
cosnt palSession = PALFactory.createPALSession(allowStorage, logger);

Get Nonce

Loads a nonce manager given the configuration and returns the nonce that the publisher should add to their ad requests as the value for the &paln URL parameter.

PALConfiguration properties

PropertyTypeDescription
willAdAutoPlaybooleanDefines whether the ad will be auto played without waiting for user interaction or not.
willAdPlayMutedbooleanDefines whether the ad will be played while muted or not.
continuousPlaybackbooleanDefines whether the player intends to continuously play the content videos one after another similar to TV broadcast or video playlist.
descriptionUrlstringDefines the description URL of the content during which the ad will be played.
iconsSupportedbooleanDefines whether VAST icons are supported by the video player.
nonceLengthLimitnumberDefines the length limit of the generated nonce.
omidPartnerNamenumberThe name of the partner integrating OMID measurement.
omidPartnerVersionstringThe version of the partner integrating OMID measurement.
omidVersionstringThe version of OMID that the player responsible for ad playback integrates with.
playerTypestringThe partner provided player type.
playerVersionstringThe partner provided player version.
ppidstringThe publisher provided ID.
videoHeightnumberThe height of the ad video element.
videoWidthnumberThe width of the ad video element.
palSession
.initialize(palConfiguration)
.then((nonce) => {
console.log(`Google PAL nonce: ${nonce}`);
})
.catch((error) => {
console.log(`Google PAL nonce failed: ${error}`);
});

Session Events

Trigger the following events to notify the playback events to PALSession

Send Playback Start

In order to notify to Google server that playback is started you need to call the method sendPlaybackStart without any parameters.

palSession.sendPlaybackStart();

Send Playback End

In order to notify to Google server that playback is ended you need to call the method sendPlaybackEnd without any parameters.

palSession.sendPlaybackEnd();

Send Ad Click

In order to notify to Google server when the user clicks on the ad that was requested with the nonce generated by this manager.

palSession.sendAdClick();

Send Ad Touch

In order to notify to Google server about any touch interaction with the player, The browser touch or click event that was fired for the user interaction.

palSession.sendAdTouch(clickOrTouchEvent);

Destroy PAL Session

Destroys the internal nonce loader and nonce manager so this session cannot be used anymore.

palSession.shutdown();