Native JS APP
Instructions on how to integrate your codes into OpenAD Protocol for native JS APP.
This document provides instructions on how to access the SDK in native HTML (Games, etc.).
Step #1. Load SDK
#1. 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 script will pick OpenAD node for your end users, and load proper version of OpenAD SDK for you.
#2. Add DOM placeholder for Ad banner
zoneld="158", 158 is a demo zoneld, please use your own "zoneId". publisherld="49", 49 is a demo publisherld, please use your own "publisherld" feel free to define your own banner style
OpenAD SDK will get ad banner for your end users and has it rendered in the DOM placeholder.
In traditional web applications, you can see OpenAD banner been rendered.
Step #2. Get Ad Info
Please embed the following code into the body.
Event Callback
Event Callback
If the user is already logged in,
Initialize user data (optional, not need to set in TMA)
window.openAdNative.initUserInfo(data);
Get Ad Info
window.openAdNative.getAD();
Close AD
window.openAdNative.destroy(window.openAdNative.adInfo);
Last updated