Version: stable
levelplay.set_callback(callback)
Sets the callback used for all LevelPlay events. Pass nil to remove it.
PARAMETERS
callback |
function |
|
levelplay.init(app_key,user_id)
Initializes LevelPlay. Configure privacy before calling this function. Create ad objects only after EVENT_INIT_SUCCEEDED.
PARAMETERS
app_key |
string |
Application key from the LevelPlay dashboard. This is not an ad-unit ID. |
user_id |
string |
Stable application user ID included in the initialization request. |
levelplay.get_sdk_version()
Returns the native LevelPlay SDK version.
PARAMETERS
None
RETURNS
string |
levelplay.set_gdpr_consent(consent)
Sets the user's GDPR consent choice. Call before init and map the value to a choice collected by your consent flow.
PARAMETERS
consent |
boolean |
levelplay.set_ccpa(opted_out)
Passes a US privacy "do not sell or share" choice. True means the user opted out. Call before init.
PARAMETERS
opted_out |
boolean |
levelplay.set_coppa(child_directed)
Sets whether the user is child-directed for COPPA treatment. True flags the user as child-directed. Call before init.
PARAMETERS
child_directed |
boolean |
levelplay.set_metadata(key,value)
Sets an SDK or mediated-network metadata value. Set network-required values before init.
PARAMETERS
key |
string |
|
value |
string |
levelplay.set_meta_limited_data_use(enabled,country,state)
Configures Meta Audience Network Limited Data Use before init. This calls Meta's SDK directly and returns false if the Meta adapter is not linked or initialization already started.
PARAMETERS
enabled |
boolean |
True supplies the LDU option; false clears Meta data-processing options. |
country |
number |
Meta country code. Zero, the default, asks Meta to geolocate. |
state |
number |
Meta state code. Zero, the default, asks Meta to geolocate. |
RETURNS
boolean |
levelplay.set_meta_advertiser_tracking(enabled)
Sets Meta Audience Network's iOS advertiser-tracking flag before init. Returns false on Android, when Meta is not linked, or after initialization starts.
PARAMETERS
enabled |
boolean |
RETURNS
boolean |
levelplay.set_dynamic_user_id(user_id)
Sets the dynamic user ID used by server-to-server rewarded callbacks. The value must contain 1–64 alphanumeric characters. Call before showing the rewarded ad it should apply to.
PARAMETERS
user_id |
string |
RETURNS
boolean |
levelplay.set_adapters_debug(enabled)
Enables or disables mediated-network debug logging. Disable it in production.
PARAMETERS
enabled |
boolean |
levelplay.validate_integration()
Runs the native LevelPlay integration validator.
PARAMETERS
None
levelplay.launch_test_suite()
Opens the LevelPlay integration test suite after initialization succeeds. Enable the is_test_suite metadata before init and call this before creating ad objects or invoking other LevelPlay SDK operations.
PARAMETERS
None
levelplay.request_tracking_authorization()
Requests App Tracking Transparency authorization on iOS 14 or newer. Request it before init when mediation partners should receive the IDFA. The result is sent through MSG_TRACKING. It is a no-op on Android and unsupported iOS versions.
PARAMETERS
None
levelplay.get_tracking_authorization_status()
Returns the current App Tracking Transparency state on iOS, or nil when unsupported.
PARAMETERS
None
RETURNS
number |
One of TRACKING_STATUS_NOT_DETERMINED, TRACKING_STATUS_RESTRICTED, TRACKING_STATUS_DENIED, or TRACKING_STATUS_AUTHORIZED. |
levelplay.create_interstitial_ad(ad_unit_id,bid_floor)
Creates a reusable interstitial ad object after successful initialization. Its ad-unit ID and optional bid floor are fixed for the object's lifetime. Create it once, then use the returned handle for multiple load/show cycles with the same ad-unit ID and creation configuration.
PARAMETERS
ad_unit_id |
string |
Interstitial ad-unit ID from the LevelPlay dashboard. |
bid_floor |
number |
Optional minimum eCPM in USD. It applies to every load by this object; changing it requires destroying the handle and creating a new object. |
RETURNS
number |
Positive handle, or nil when native creation is rejected. |
levelplay.destroy_interstitial_ad(handle)
Permanently releases an interstitial ad object, invalidates its handle, and stops callbacks for it. Do not destroy between ordinary impressions or during load/display when terminal callbacks are still required.
PARAMETERS
handle |
number |
levelplay.load_interstitial_ad(handle)
Loads the next interstitial impression into an existing object. After an impression closes, call this again on the same handle instead of creating another object.
PARAMETERS
handle |
number |
levelplay.is_interstitial_ad_ready(handle)
Returns whether the interstitial object has an ad ready to display.
PARAMETERS
handle |
number |
RETURNS
boolean |
levelplay.show_interstitial_ad(handle,placement)
Shows one loaded interstitial impression. The optional placement is a dashboard presentation point, not an ad object, and can be selected separately on every show.
PARAMETERS
handle |
number |
|
placement |
string |
levelplay.is_interstitial_placement_capped(placement)
Returns whether the named interstitial placement has reached its configured cap.
PARAMETERS
placement |
string |
RETURNS
boolean |
levelplay.create_rewarded_ad(ad_unit_id,bid_floor)
Creates a reusable rewarded ad object after successful initialization. Its ad-unit ID and optional bid floor are fixed for the object's lifetime. Create it once, then use the returned handle for multiple load/show cycles with the same ad-unit ID and creation configuration.
PARAMETERS
ad_unit_id |
string |
Rewarded ad-unit ID from the LevelPlay dashboard. |
bid_floor |
number |
Optional minimum eCPM in USD. It applies to every load by this object; changing it requires destroying the handle and creating a new object. |
RETURNS
number |
Positive handle, or nil when native creation is rejected. |
levelplay.destroy_rewarded_ad(handle)
Permanently releases a rewarded ad object, invalidates its handle, and stops callbacks for it. Do not destroy between ordinary impressions, and never destroy a displayed rewarded ad before its reward and close callbacks are received.
PARAMETERS
handle |
number |
levelplay.load_rewarded_ad(handle)
Loads the next rewarded impression into an existing object. After reward and close callbacks complete, call this again on the same handle instead of creating another object.
PARAMETERS
handle |
number |
levelplay.is_rewarded_ad_ready(handle)
Returns whether the rewarded object has an ad ready to display.
PARAMETERS
handle |
number |
RETURNS
boolean |
levelplay.show_rewarded_ad(handle,placement)
Shows one loaded rewarded impression. The optional placement is a dashboard presentation point, not an ad object, and can be selected separately on every show.
PARAMETERS
handle |
number |
|
placement |
string |
levelplay.is_rewarded_placement_capped(placement)
Returns whether the named rewarded placement has reached its configured cap.
PARAMETERS
placement |
string |
RETURNS
boolean |
levelplay.get_reward(handle,placement)
Returns the configured reward for the object's default placement or for the supplied placement.
PARAMETERS
handle |
number |
|
placement |
string |
RETURNS
table |
levelplay.create_banner_ad(ad_unit_id,options)
Creates a reusable banner ad view after successful initialization. Its ad-unit ID and all options are fixed for the view's lifetime. Create it once, then load, hide, show, and auto-refresh the same handle until it is permanently destroyed.
PARAMETERS
ad_unit_id |
string |
Banner ad-unit ID from the LevelPlay dashboard. | |||||||||||||||
options |
table |
Creation-time banner configuration. These fields apply to every load and show; changing one requires destroying the handle and creating a new banner.
|
RETURNS
number |
Positive handle, or nil when native creation is rejected. |
levelplay.load_banner_ad(handle)
Loads and displays a banner because the native LevelPlay banner view is visible by default.
PARAMETERS
handle |
number |
levelplay.show_banner_ad(handle)
Makes the banner view visible.
PARAMETERS
handle |
number |
levelplay.hide_banner_ad(handle)
Hides the banner without destroying it.
PARAMETERS
handle |
number |
levelplay.pause_banner_auto_refresh(handle)
Pauses automatic refresh for the banner.
PARAMETERS
handle |
number |
levelplay.resume_banner_auto_refresh(handle)
Resumes automatic refresh for the banner.
PARAMETERS
handle |
number |
levelplay.destroy_banner_ad(handle)
Removes and destroys the banner view and invalidates its handle.
PARAMETERS
handle |
number |