GoogleMobileAds Framework Reference Stay organized with collections Save and categorize content based on your preferences.
GADRequest
classGADRequest:NSObject,NSCopyingSpecifies optional parameters for ad requests.
Returns a default request.
Ad networks may have additional parameters they accept. To pass these parameters to them, createthe ad network extras object for that network, fill in the parameters, and register it here. Thead network should have a header defining the interface for the ‘extras’ object to create. Allnetworks will have access to the basic settings you’ve set in this GADRequest. If you registeran extras object that is the same class as one you have registered before, the previous extraswill be overwritten.
Declaration
Swift
funcregister(_extras:GADAdNetworkExtras)Returns the network extras defined for an ad network.
Declaration
Swift
funcadNetworkExtras(foraClass:GADAdNetworkExtras.Type)->GADAdNetworkExtras?Removes the extras for an ad network. |aClass| is the class which represents that network’sextras type.
Declaration
Swift
funcremoveAdNetworkExtras(foraClass:GADAdNetworkExtras.Type)
Returns the version of the SDK.
Declaration
Swift
classfuncsdkVersion()->String
Test ads will be returned for devices with device IDs specified in this array.
Declaration
Swift
vartestDevices:[Any]?{getset}
The user’s current location may be used to deliver more relevant ads. However do not use CoreLocation just for advertising, make sure it is used for more beneficial reasons as well. It isboth a good idea and part of Apple’s guidelines.
Declaration
Swift
funcsetLocationWithLatitude(_latitude:CGFloat,longitude:CGFloat,accuracyaccuracyInMeters:CGFloat)
Array of keyword strings. Keywords are words or phrases describing the current user activitysuch as @
Sports Scores
or @Football
. Set this property to nil to clear the keywords.Declaration
Swift
varkeywords:[Any]?{getset}URL string for a webpage whose content matches the app content. This webpage content is used fortargeting purposes.
Declaration
Swift
varcontentURL:String?{getset}
String that identifies the ad request’s origin. Third party libraries that reference the MobileAds SDK should set this property to denote the platform from which the ad request originated.For example, a third party ad network called
CoolAds network
that is mediating requests to theMobile Ads SDK should set this property asCoolAds
.Declaration
Swift
varrequestAgent:String?{getset}
Deprecated property. The user’s gender.
Declaration
Swift
vargender:GADGender{getset}Deprecated property. The user’s birthday.
Declaration
Swift
varbirthday:Date?{getset}Provide the user’s birthday to increase ad relevancy.
Declaration
Swift
funcsetBirthdayWithMonth(_month:Int,day:Int,year:Int)When Core Location isn’t available but the user’s location is known, supplying it here maydeliver more relevant ads. It can be any free-form text such as @
Champs-Elysees Paris
or@94041 US
.Declaration
Swift
funcsetLocationWithDescription(_locationDescription:String?)[Optional] This method allows you to specify whether you would like your app to be treated aschild-directed for purposes of the Children’s Online Privacy Protection Act (COPPA),http://business.ftc.gov/privacy-and-security/childrens-privacy.
If you call this method with YES, you are indicating that your app should be treated aschild-directed for purposes of the Children’s Online Privacy Protection Act (COPPA). If you callthis method with NO, you are indicating that your app should not be treated as child-directedfor purposes of the Children’s Online Privacy Protection Act (COPPA). If you do not call thismethod, ad requests will include no indication of how you would like your app treated withrespect to COPPA.
By setting this method, you certify that this notification is accurate and you are authorized toact on behalf of the owner of the app. You understand that abuse of this setting may result intermination of your Google account.
It may take some time for this designation to be fully implemented in applicable Googleservices. This designation will only apply to ad requests for which you have set this method.
Declaration
Swift
functag(forChildDirectedTreatmentchildDirectedTreatment:Bool)
Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2021-03-03 UTC.