GADRequest

class GADRequest : NSObject, NSCopying

Specifies optional parameters for ad requests.

  • Ad networks may have additional parameters they accept. To pass these parameters to them, create the ad network extras object for that network, fill in the parameters, and register it here. The ad network should have a header defining the interface for the ‘extras’ object to create. All networks will have access to the basic settings you’ve set in this GADRequest. If you register an extras object that is the same class as one you have registered before, the previous extras will be overwritten.

    Declaration

    Swift

    func register(_ extras: GADAdNetworkExtras)
  • Returns the network extras defined for an ad network.

    Declaration

    Swift

    func adNetworkExtras(for aClass: GADAdNetworkExtras.Type) -> GADAdNetworkExtras?
  • Removes the extras for an ad network. |aClass| is the class which represents that network’s extras type.

    Declaration

    Swift

    func removeAdNetworkExtras(for aClass: GADAdNetworkExtras.Type)
  • Returns the version of the SDK.

    Declaration

    Swift

    class func sdkVersion() -> String
  • Test ads will be returned for devices with device IDs specified in this array.

    Declaration

    Swift

    var testDevices: [Any]? { get set }
  • The user’s current location may be used to deliver more relevant ads. However do not use Core Location just for advertising, make sure it is used for more beneficial reasons as well. It is both a good idea and part of Apple’s guidelines.

    Declaration

    Swift

    func setLocationWithLatitude(_ latitude: CGFloat, longitude: CGFloat, accuracy accuracyInMeters: CGFloat)
  • Array of keyword strings. Keywords are words or phrases describing the current user activity such as @Sports Scores or @Football. Set this property to nil to clear the keywords.

    Declaration

    Swift

    var keywords: [Any]? { get set }
  • URL string for a webpage whose content matches the app content. This webpage content is used for targeting purposes.

    Declaration

    Swift

    var contentURL: String? { get set }
  • String that identifies the ad request’s origin. Third party libraries that reference the Mobile Ads 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 the Mobile Ads SDK should set this property as CoolAds.

    Declaration

    Swift

    var requestAgent: String? { get set }
  • Deprecated property. The user’s gender.

    Declaration

    Swift

    var gender: GADGender { get set }
  • Deprecated property. The user’s birthday.

    Declaration

    Swift

    var birthday: Date? { get set }
  • Provide the user’s birthday to increase ad relevancy.

    Declaration

    Swift

    func setBirthdayWithMonth(_ month: Int, day: Int, year: Int)
    </