Programmatic ads handler
Dejacast player facilitates the interaction with programmatic video ads, enabling the player to request a programmatic ad, before requesting the ad URLs configured in the dashboard.
Enabling this integration requires publishers to include a script in the pages where this functionality is needed. The script will expose a function that interacts with publisher's own header bidding.
Requirements
Before proceeding with the integration, ensure the following:
- Dejacast player is properly embedded on your web page.
- At least one ad strategy is enabled and correctly configured in Dejacast dashboard, under Settings > Players > [Your Player] > Advertising Tab.
- Header bidding is configured and enabled to handle video ad requests on the publisher's website.
Setting up the script
A function called dj_playerAdsProxy should be implemented in your web page. This function will be called by the Dejacast player to retrieve the ad information.
<script>
async function dj_playerAdsProxy(playerid){
// your header bidding logic for getting the values of {{ad}} and {{cust_params}}
// ...
// creating the response object
let data = {
enabled: 'true',
ad: '{{ad}}',
custParams: '{{cust_params}}'
}
return data;
}
</script>
Input:
player_idthe id of the player that calls the function. Useful to determine the type of ad unit (in-article, floating, etc), according to the specific player config.
Response object:
enabled: <boolean>whether the function response should or should not be consideredad: <string>the ad URL of the winning bidcust_params: <string> <optional>an URL encoded string that will be added to the "cust_params" flag of the ad request
The end-to-end flow
- The Dejacast player calls
dj_playerAdsProxy(player_id)and waits for an ad response. - If an ad response is received and the function is enabled, then the ad will be displayed. Then, the player resumes its specific logic, according to its dashboard config
- If no ad response is received or the function is not enabled, the player will fallback to the first ad in the dashboard config, following its specific logic, according to its dashboard config.
- At the start of a new ad request cycle, this flow also restarts, see Point 1.