applovin.setHasUserConsent()

Type Function
Return value none
Revision Release 2024.3703
Keywords ads, advertising, AppLovin, setHasUserConsent
See also applovin.init()
applovin.load()
applovin.isLoaded()
applovin.setIsAgeRestrictedUser()
applovin.*

Overview

AppLovin SDK requires that publishers set a flag indicating whether the user has provided the publisher opt-in consent for the collection and use of personal data.

Syntax

applovin.setHasUserConsent( hasUserConsent )
hasUserConsent (required)

Boolean. If the user has consented, please set the following flag to true, otherwise set it to false. The default value is false.

Example

local applovin = require( "plugin.applovin" )

local function adListener( event )

    if ( event.phase == "init" ) then  -- Successful initialization
        -- Set user consention
        applovin.setHasUserConsent( true )
    end
end

-- Initialize the AppLovin plugin
applovin.init( adListener, { sdkKey="YOUR_SDK_KEY" } )