Type Function
Return value none
Revision Release 2023.3686
Keywords ads, advertising, StartApp, setUserConsent
See also startapp.*


startapp.setUserConsent() indicates specific type of consent from a given user.

Data protection and privacy regulations may require you and your company to obtain consent from users before processing personal data and to honor users' requests for how you use their personal data. StartApp is required to record these consent logs and thus we have provided you with an API which enables you to send this consent from your user to StartApp. Based on consent signals that you send, StartApp uses the data to target the most relevant campaigns to your users. Without receiving this consent we will not be able to send targeted ads (but rather non-targeted ads)


startapp.setUserConsent( params )
params (required)

Table. Table containing user-consent values — see the next section for details.

Parameter Reference

The params table includes parameters for sending user consent.

consentType (required)

String. type of consent. For example "ACCESS_FINE_LOCATION" for ACCESS_FINE_LOCATION permission.

timestamp (required)

Number. the specific time a consent / dissent was given by the user. Use os.time().

enabled (required)

Boolean. true indicates consumer consent, false indicates consumer dissent.


local startapp = require( "plugin.startapp" )

-- StartApp listener function
local function adListener( event )
    if ( event.phase == "init" ) then  -- Successful initialization
        print( event.provider )

-- Initialize the StartApp plugin
startapp.init( adListener, { appId="Your App ID", enableReturnAds = true } )

-- Sometime later
    consentType = "ACCESS_FINE_LOCATION",
    timestamp = os.time(),
    enabled = true