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.
Property | Type | Required | Description |
---|---|---|---|
allowStorage | boolean | true | Whether 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. |
logger | Logger | false | Logs 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
Property | Type | Description |
---|---|---|
willAdAutoPlay | boolean | Defines whether the ad will be auto played without waiting for user interaction or not. |
willAdPlayMuted | boolean | Defines whether the ad will be played while muted or not. |
continuousPlayback | boolean | Defines whether the player intends to continuously play the content videos one after another similar to TV broadcast or video playlist. |
descriptionUrl | string | Defines the description URL of the content during which the ad will be played. |
iconsSupported | boolean | Defines whether VAST icons are supported by the video player. |
nonceLengthLimit | number | Defines the length limit of the generated nonce. |
omidPartnerName | number | The name of the partner integrating OMID measurement. |
omidPartnerVersion | string | The version of the partner integrating OMID measurement. |
omidVersion | string | The version of OMID that the player responsible for ad playback integrates with. |
playerType | string | The partner provided player type. |
playerVersion | string | The partner provided player version. |
ppid | string | The publisher provided ID. |
videoHeight | number | The height of the ad video element. |
videoWidth | number | The 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();