Transcript for:
Integrating UMP SDK with Unity for User Consent

[Music] welcome back to another Google admob developer tutorial my name is Justin mandulo and today I'm going to show you how to integrate the user messaging platform SDK or ump SDK into your app on Unity the UMP SDK provides a collection of apis that you can use to gather consent from your users which helps you to comply with privacy laws and reg ations let's take a look at the ab mob user interface and see the Privacy message I have configured which the um SDK presents giving your users the ability to consent to how their data is used a complete integration of the UMP SDK includes the following key steps I'll walk you through each step using our existing hello world sample which is linked in the description first we'll request for consent information then load and present a privacy message I'll show you when to initialize the Google mobile ads SDK then we will test your integration next Implement a privacy options button and lastly I'll talk about how to optimize your integration so let's jump into a demo here we have our hello world sample which has two relevant scripts for this video Google mobile ads controller and our helper file Google mobile ads consent controller all ump code will live in the consent controller class starting in the Google mobile ads consent controller let's import the UMP SDK which is already packaged in with the Google mobile ads SDK so step one let's request for the most recent consent information it's important to do this on every app launch to start in our gather consent helper method initialize a blank consent request parameters object next type consent information. update which requires a call back and our request parameters the call back returns a nullable form air for any air handling you'll want to forward the call back to the action passed into the helper method that's all you need to do to fetch the most up-to-date consent information step two load and present a consent form inside the call back type consent form. load and show consent form if required in this step be sure to also forward the call back to the action passed into the gather consent helper method if the method does doesn't throw an air it will do one of two things if consent is required for this user the SDK loads and presents a consent form the call back returns when the form is dismissed or if consent is not required the call back is invoked immediately at this point you now have enough information to initialize the Google mobile ads SDK and start loading ads one more thing add a can request ads helper variable that can be accessed from our Google mobile ads controller class jumping into our Google mobile ads controller class let's now use our helper class to initialize the SDK we want to initialize the mobile ads SDK after the consent Gathering process has completed with our consent controller call its helper method query can request ads as a layer of verification before initializing the SDK if it returns true you're good to go I'm recording this in New York so I won't see a gdpr consent form but what if I want to see how my app behaves for users in privacy regulated regions such as Europe This is possible with just a few lines of code back in our consent controller class create the consent debug settings object and set the debug geography to debug geography. EA for this tutorial we're going to use the iOS platform as our example after building let's run our app and there we have a consent form if you are using a real iOS device run the app and check the logs for test device identifiers all one word for those on Android check the logs for consent debug settings all one word the log will include an alpha numeric ID that you can extract and replace this placeholder string with in your debug settings now that we know how to show a consent form on app start we now have to let users modify their consent choices in your app at any time this is commonly done by adding a button in your app's settings page still in the consent controller class in the update call back check consent information. privacy options requirement status to determine if you need to enable your button or not if the status is required the button should be enabled when a user interacts with your button present the form using consent form. shell privacy options form the call back is invoked when the form is dismissed or if an error occurs and then forward the call back to the action passed into our helper method switching to our Google mobile ads controller class we can invoke the helper method like so let's run our app again our new privacy settings button is now wired up lastly let's talk about app optimization your app will have already gathered consent from returning users SO waiting for consent information's update call back can delay your ad impression you can optimize this by attempting to initialize the SDK outside of the update callback checking the can request ads API in two places ensures an optimal ads experience for new users and returning users as part of this optimization make sure to add a Boolean flag to only initialize the SDK and load ads once during the consent Gathering process and there you have it to learn more check out the resources in the description below today we walk through how to gather consent in your mobile application by fetching consent information and loading a privacy message we then use that information to initialize the mobile ads SDK and enable a privacy settings button we hope the video was helpful for you feel free to give it a thumbs up and leave a comment and remember to subscribe to admob for more technical content