unityads.setPrivacyMode()

Type Function
Return value none
Revision Release 2024.3703
Keywords ads, advertising, unityads, setHasUserConsent
See also [unityads.init()][plugin.unityad-v4.init]
[unityads.*][plugin.unityad-v4]

Overview

Set flag for compliance mode for the app before initialization (before [unityads.init()][plugin.unityad-v4.init])

Syntax

unityads.setPrivacyMode( privacyMode )
privacyMode (required)

String. supported modes are “app” (indicates that an app is directed at children), “mixed” (indicates that an app is directed at mixed audiences), or “none” (indicates that the entire app is not directed at children)

Example

local unityads = require( "plugin.unityads.v4" )

local function adListener( event )

    if ( event.phase == "init" ) then  -- Successful initialization

    end
end

-- Flag for privacy mode before initialize
unityads.setPrivacyMode( "app" )

-- Initialize the Unity Ads plugin
unityads.init( adListener, { appId="YOUR_UNITYADS_GAME_ID" } )