The course is part of this learning path
This course will show you how we can make money out of your apps. We'll explore the alternative ways to make money using IOS development as well as how to use Google advertisements in your app so that you can earn money with Google ads.
This course is designed for anyone who wants to:
- Learn about iOS development and coding
- Move into a career as an iOS developer
- Master Swift skills
To get the most out of this course, you should have some basic knowledge of iOS.
Hi. Within this lecture, we're going to see a very recent concept that came into our lives. It actually came into our lives with iOS 14.5. It will be very Important starting with 2022. So, we're going to have to learn about this concept not only for AdMob, but also for other third party libraries that we're working with as well. So, what do I mean and what do we have to learn? Let me just close this down. This is all related with AdMob and go back to this. So, the concept that we're talking about app tracking transparency and it's not particularly related with AdMob and we're done with AdMob. So, I'm just going to close everything over here and come back to here to prepare for iOS 14. You don't have to open the prepare for iOS 14, I'm just going to show you something related with app tracking transparency. So, this is a new concept and again, it's not related with AdMob, it's generally related with privacy of the users. So, Apple said that you must use this app tracking transparency framework, it's kind of a framework or library if you will and if you're collecting data about users, if you're sharing with other companies for purposes of tracking across applications and websites. So, of course many big companies like Facebook didn't like that idea because they're collecting information with Facebook and they're distributing that information to WhatsApp or Instagram so that they can show targeted ads and they didn't like that concept, but Apple decided that it's a must for the privacy of the user, so they developed this app tracking transparency thingy. And it actually is a concern for us if you're using AdMob or any related third party library and in fact there are a lot of things that we should consider when you're working with this and I'm going to show you every one of them. First of all, again it's not only related with AdMob, since we have seen Firebase extensively in this application, in this course, I'm going to show you that Firebase says that we are not affected by this at all. So, I have found the documentation, it says that, these Firebase products are not affected as you can see Firestore, no impact, functions, no impact, installations, no impact. So, you can continue using Firebase and if you're using Google Analytics, I believe it has some kind of tweaks that you need to do when it comes to Google Analytics but for the scope of this training, there is no thing that you should do with when it comes to ATT. But that is not the case with Google AdMob. So, there is a documentation about focusing on the iOS 14 and there's something you should do in order to get an authorization for ATT. But in fact, it's not an obligation right now, it's not mandatory to do that, but it may change in the 2022 and so forth. So, I'm going to show you how to implement this. The idea here is that you don't have to do anything right now if you're following along with this course but for future in your career, maybe you may want to work with a third party library, that you should implement this app tracking transparency in a proper way then you should know actually what to do. And first thing you should do is to set up on a user tracking usage description which is actually an info.plist item that shows a message to the user, for example, you have to give me authorization to have a personalized ads. Then you're going to have to ask for authorization and just do the things depending that authorization. The thing with the AdMob is that you don't need that authorization, Google took care of that. But it also shows you how to implement that if you want to implement that. We're going to see how to implement that again, you don't have to do it right now but maybe for some reason you're going to use another library that requires this strictly then you should know how to work with ATT. So, in the end we're going to have something like this, like a dialogue like this and user will give this authorization to us or not. But it won't change the fact that we're going to display the ads to the user. What it changes, what is interested in that actually is personally identifiable things such as the interests of the user or something like that. What Google is doing over here as you can see in the documentation as well, we're going to ask for the tracking authorization. It will give us some status whether it's authorized or not. However we're going to load the ad. We won't even care what's this status. Why is that? Because again, it's actually interested in the development categories or like the personal identifiable categories of the user and ATT is interested in that as well, but Google says that if you have implemented the info.plist Adwords, the ad networks; Adwords or ad networks if you have implemented those things then I'm gonna take care of those things for you, don't worry about this at all. I'm going to collect the information, I'm going to display the ads to the user in a way that you want. So, don't forget to implement the ad networks to your info.plist and everything will be fine. But again, so we have done this right, we don't have to do it again. But it may change over time. So, in the documentation it says that please once in a while come back here and just update your info.plist with the new networks in the new ad networks and you will be fine. So, for example, once you publish your application you're going to have to do some updates regularly before updating your application. Maybe you can come back here and just check this network and just include them into your info.plist and just upload to the updated networks to your app store account. So, whether this is an obligation or not, whether this is mandatory or not, we're going to see how to implement this ATT thing again, even though it's not required in this course, maybe you will need it later on in your future career. So, what I'm going to do, I'm going to follow along with this example and just implement every step one by one. First of all, it asks me to include that NSUserTrackingUsageDescription in the info.plist and again, it's consistent with the app tracking transparency documentation over here; as you can see it says setup an NSUserTrackingDescription over there. So, you can copy and paste this with the XML view or you can create a new line over here and scroll down to find the privacy. Under the privacy, there should be something called tracking usage description which is exactly what we need. Right now, I'm just going to say personalized ad or something like that of course you're going to have to give like a good description. If you just I love this, you're going to see personalized ads or something like that. So, number 1 is done, step 1 is done. Now after the dialogue, it will appear in here, this usage description will be appearing over here. Now the second and third step is actually very easy as well. All we got to do is just to import this app tracking transparency and ask for the request with ATT tracking manager class. Now I'm going to come over here and import that. So, if you're watching this in 2021 then you're going to have to have the latest Xcode; if you're watching this later 2022 and later on then it's okay. So, you're going to have to import that and before we load the request, I'm going to call the ATTrackingManager.requestTrackingAuthorization as you can see it has a completion handler and if you hit 'Enter' you will see that it will give us the status. So, this will be the status of the authorization. So, I'm going to call the status and it's okay right now and you can check to see if you get the authorization or not. You can check to see if status is .authorized or .denied. So, maybe you may want to do something over here or as if status is .denied. Maybe you may want to do something over there as well. However, it won't change the fact that we're working with AdMob. It won't just change anything in our case. As you can see we're getting an error. It says that, ATT tracking manager is only available iOS 14. If you hit 'Fix', now it will add something like this; if it's available. If the device is working on iOS 14 then it's okay. I'm going to delete the else block over here because we don't need it. So, I'm going to say, if status is authorized then I'm going to do something over there or else if the status is denied, maybe I want to do something over there. So, we're not even going to do anything over here. Again, the AdMob took care of this. It says that, if you want to ask for this ATT, then ask it and just load the ad under this call back. You don't do this under the status or authorized status or denied status, you just do it over here. So, in the documentation it says so. Maybe it will change in future but right now it says so. So, we can just do it like this and just show our ads. And if we have integrated the things in the info.plist, then we are good to go. If you don't include them then maybe it will show the ads again to the user but it will be irrelevant ads, you will experience a revenue loss which many developers actually experienced before when actually Apple released the iOS 14 because it will show irrelevant ads, maybe you're not interested in grocery shopping but you will see ads regarding grocery shopping and you will not click on them or you will not display them, you will just close down the application. So, if you follow along with this, then you're good to go to show your ads; if I open this. Let's try this. Let's see if we get the dialogue or not first of all, if we can see the ATT dialogue. Here you go, we see the ATT dialogue and it says personal ads over here. This is the description we have written in the info.plist. I'm going to allow this first of all. I'm going 'Allow' this and just click on 'Next' and here you go, we see the ad over here. So, I will try not allowing that as well, I'm going to close down this application and I'm even going to remove that app from my device, so that when I run it from scratch, it will ask me for that authorization one more time and I will not allow that this time and I will see if I'm getting the ad or not. So, let's try this together and here we go. We're getting this dialogue. I'm not going to allow this, this time. But even though I don't allow it, I still get the ad. Again, this doesn't depend on the ATT right now. If you updated your info.plist, you're good to go. But the reason that we saw that it isn't particularly about the AdMob. It is about some possible data collection and sharing this data with other companies. So, if you're in that kind of situation in your application, then you're going to have to implement that ATT tracking thingy and this is how you do it, this is how you should do it. That's why we have this lecture in this course, not for AdMob reasons, but for understanding the ATT implementation reasons. With that being said, that's it. See you in the next section.
Atil is an instructor at Bogazici University, where he graduated back in 2010. He is also co-founder of Academy Club, which provides training, and Pera Games, which operates in the mobile gaming industry.