Create Interactive Ads
Instructions on how to create interactive ads by integrating your codes into OpenAD Protocol.
Ad rendering and user interaction will notify publishers and/or advertisers upon request. This feature is suitable for providing traditional gaming incentive scenarios to publisher TMAs, such as extra lives for ad viewing.
Interactive ads will be presented in full screen, ads will be displayed for a certain time, and the number of impressions is calculated by CPM.
OpenAD will notify publishers of ad display events,
adResourceLoad
, indicates load ad resource from OpenAD platform,false
will be returned if there is no resource to be loaded for the publisher slot/zone,adOpening
, indicates the interactive ad is opening,adOpened
, indicates the interactive ad is opened,adTaskFinished
, indicates the interactive ad task is finished, the task is defined by advertiser,adClosing
, indicates the interactive ad is closing,adClosed
, indicates the interactive ad is closed.adClick
, indicates clicked and jumps.
This document provides instructions on how to use OpenAD js SDK to create interactive ads on PC (Desktop Web App), Mobile H5 (Mobile Web App), and TMA (Telegram Mini App).
Step #1. Load SDK
Load the SDK in the body of html, the code is as follows:
We recommend to add your application version number or release timestamp after JS to obtain the latest JS SDK for your application. E.g.,
https://protocol.openad.network/sdkloader.js?t=your-app-release-timestamp https://protocol.openad.network/sdkloader.js?v=your-app-version
The following global vairables will be loaded with 'https://protocol.openad.network/sdkloader.js'.
openADSdkLoader.hostURL
, node api url to serve end user. e.g., https://bf2055756e.api.openad.network .
The script will pick OpenAD node for your end users, and load proper version of OpenAD SDK for you.
Step #2. Init OpenAD resource for interactive ad
The interactive ads shall be init manually.
Please follow the guideline to add the following js code.
Step #3. Get Ad And Render
Notices
After executing the init method, determine whether to continue executing the getRender method based on the status of res.code!
Please pay attention to your page flow design, there may be res.code !== 0. In the case of res.code === 0, please execute the getRender method as soon as possible. The data is time-sensitive. After the timeout, the ad delivery will be invalid.
There are 7 callback methods for calling the getRender method, which can be called on demand!
The client must re-execute the init method every time to determine whether the AD can be loaded. Otherwise, the data statistics will only take effect once, and multiple repeated impressions cannot be counted!!!
Last updated