extension-levelplay

Namespace: levelplay Language: Lua Type: Extension

Functions and constants for Unity LevelPlay mediation on Android and iOS.

API

levelplay.set_callback

Type: FUNCTION Sets the callback used for all LevelPlay events. Pass nil to remove it.

Parameters

levelplay.init

Type: FUNCTION Initializes LevelPlay. Configure privacy before calling this function. Create ad objects only after EVENT_INIT_SUCCEEDED.

Parameters

levelplay.get_sdk_version

Type: FUNCTION Returns the native LevelPlay SDK version.

Returns

Type: FUNCTION Sets the user’s GDPR consent choice. Call before init and map the value to a choice collected by your consent flow.

Parameters

levelplay.set_ccpa

Type: FUNCTION Passes a US privacy “do not sell or share” choice. True means the user opted out. Call before init.

Parameters

levelplay.set_coppa

Type: FUNCTION Sets whether the user is child-directed for COPPA treatment. True flags the user as child-directed. Call before init.

Parameters

levelplay.set_metadata

Type: FUNCTION Sets an SDK or mediated-network metadata value. Set network-required values before init.

Parameters

levelplay.set_meta_limited_data_use

Type: FUNCTION 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

Returns

levelplay.set_meta_advertiser_tracking

Type: FUNCTION 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

Returns

levelplay.set_dynamic_user_id

Type: FUNCTION 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

Returns

levelplay.set_adapters_debug

Type: FUNCTION Enables or disables mediated-network debug logging. Disable it in production.

Parameters

levelplay.validate_integration

Type: FUNCTION Runs the native LevelPlay integration validator.

levelplay.launch_test_suite

Type: FUNCTION 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.

levelplay.request_tracking_authorization

Type: FUNCTION 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.

levelplay.get_tracking_authorization_status

Type: FUNCTION Returns the current App Tracking Transparency state on iOS, or nil when unsupported.

Returns

levelplay.create_interstitial_ad

Type: FUNCTION 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

Returns

levelplay.destroy_interstitial_ad

Type: FUNCTION 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

levelplay.load_interstitial_ad

Type: FUNCTION 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

levelplay.is_interstitial_ad_ready

Type: FUNCTION Returns whether the interstitial object has an ad ready to display.

Parameters

Returns

levelplay.show_interstitial_ad

Type: FUNCTION 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

levelplay.is_interstitial_placement_capped

Type: FUNCTION Returns whether the named interstitial placement has reached its configured cap.

Parameters

Returns

levelplay.create_rewarded_ad

Type: FUNCTION 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

Returns

levelplay.destroy_rewarded_ad

Type: FUNCTION 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

levelplay.load_rewarded_ad

Type: FUNCTION 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

levelplay.is_rewarded_ad_ready

Type: FUNCTION Returns whether the rewarded object has an ad ready to display.

Parameters

Returns

levelplay.show_rewarded_ad

Type: FUNCTION 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

levelplay.is_rewarded_placement_capped

Type: FUNCTION Returns whether the named rewarded placement has reached its configured cap.

Parameters

Returns

levelplay.get_reward

Type: FUNCTION Returns the configured reward for the object’s default placement or for the supplied placement.

Parameters

Returns

levelplay.create_banner_ad

Type: FUNCTION 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

Returns

levelplay.load_banner_ad

Type: FUNCTION Loads and displays a banner because the native LevelPlay banner view is visible by default.

Parameters

levelplay.show_banner_ad

Type: FUNCTION Makes the banner view visible.

Parameters

levelplay.hide_banner_ad

Type: FUNCTION Hides the banner without destroying it.

Parameters

levelplay.pause_banner_auto_refresh

Type: FUNCTION Pauses automatic refresh for the banner.

Parameters

levelplay.resume_banner_auto_refresh

Type: FUNCTION Resumes automatic refresh for the banner.

Parameters

levelplay.destroy_banner_ad

Type: FUNCTION Removes and destroys the banner view and invalidates its handle.

Parameters

MSG_INIT

Type: VARIABLE Initialization events.

MSG_INTERSTITIAL

Type: VARIABLE Interstitial-object events.

MSG_REWARDED

Type: VARIABLE Rewarded-object events.

MSG_BANNER

Type: VARIABLE Banner-object events.

MSG_TRACKING

Type: VARIABLE App Tracking Transparency status events.

EVENT_INIT_SUCCEEDED

Type: VARIABLE

EVENT_INIT_FAILED

Type: VARIABLE

EVENT_AD_LOADED

Type: VARIABLE

EVENT_AD_LOAD_FAILED

Type: VARIABLE

EVENT_AD_INFO_CHANGED

Type: VARIABLE

EVENT_AD_DISPLAYED

Type: VARIABLE

EVENT_AD_DISPLAY_FAILED

Type: VARIABLE

EVENT_AD_CLICKED

Type: VARIABLE

EVENT_AD_CLOSED

Type: VARIABLE

EVENT_AD_REWARDED

Type: VARIABLE

EVENT_AD_EXPANDED

Type: VARIABLE

EVENT_AD_COLLAPSED

Type: VARIABLE

EVENT_AD_LEFT_APPLICATION

Type: VARIABLE

EVENT_JSON_ERROR

Type: VARIABLE

TRACKING_STATUS_NOT_DETERMINED

Type: VARIABLE

TRACKING_STATUS_RESTRICTED

Type: VARIABLE

TRACKING_STATUS_DENIED

Type: VARIABLE

TRACKING_STATUS_AUTHORIZED

Type: VARIABLE

Type: VARIABLE

Type: VARIABLE

Type: VARIABLE

Type: VARIABLE

Type: VARIABLE

Type: VARIABLE

Type: VARIABLE