GoogleMobileAds Framework Reference
Stay organized with collections Save and categorize content based on your preferences.
GADRequest
@interface GADRequest : NSObject <NSCopying>
Specifies optional parameters for ad requests.
-
Returns a default request.
Declaration
Objective-C
+ (nonnull instancetype)request;
-
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: any AdNetworkExtras)
-
Returns the network extras defined for an ad network.
Declaration
Swift
func adNetworkExtras(for aClass: any AdNetworkExtras.Type) -> (any AdNetworkExtras)?
-
Removes the extras for an ad network. |aClass| is the class which represents that network’s extras type.
Declaration
Swift
func removeAdNetworkExtras(for aClass: any AdNetworkExtras.Type)
-
Scene object. Used in multiscene apps to request ads of the appropriate size. If this is nil, uses the application’s key window scene.
Declaration
Swift
weak var scene: UIWindowScene? { get set }
Objective-C
@property (nonatomic, weak, nullable) UIWindowScene *scene;
-
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: [String]? { get set }
Objective-C
@property (nonatomic, copy, nullable) NSArray<NSString *> *keywords;
-
URL string for a webpage whose content matches the app’s primary content. This webpage content is used for targeting and brand safety purposes.
Declaration
Swift
var contentURL: String? { get set }
Objective-C
@property (nonatomic, copy, nullable) NSString *contentURL;
-
URL strings for non-primary web content near an ad. Promotes brand safety and allows displayed ads to have an app level rating (MA, T, PG, etc) that is more appropriate to neighboring content.
Declaration
Swift
var neighboringContentURLs: [String]? { get set }
Objective-C
@property (nonatomic, copy, nullable) NSArray<NSString *> *neighboringContentURLStrings;
-
An identifier for a placement in reporting. A value set here will be set onto any ad returned by this request.
Declaration
Swift
var placementID: Int64 { get set }
Objective-C
@property int64_t placementID;
-
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 }
Objective-C
@property (nonatomic, copy, nullable) NSString *requestAgent;
-
Key-value pairs used for custom targeting.
Declaration
Swift
var customTargeting: [String : Any]? { get set }
Objective-C
@property (nonatomic, copy, nullable) NSDictionary<NSString *, id> *customTargeting;
-
Deprecated
Use each ad format class’s loadWithAdResponseString: instead.
Deprecated. Use each ad format class’s loadWithAdResponseString: instead.
Ad string that represents an ad response. If set, the SDK will render this ad and ignore all other targeting information set on this request.
Declaration
Swift
var adString: String? { get set }
Objective-C
@property (nonatomic, copy, nullable) NSString *adString;
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-20 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-20 UTC."],[[["\u003cp\u003e\u003ccode\u003eGADRequest\u003c/code\u003e objects specify optional parameters for ad requests, such as keywords, content URL, and custom targeting.\u003c/p\u003e\n"],["\u003cp\u003eYou can register and remove ad network extras using \u003ccode\u003eregisterAdNetworkExtras:\u003c/code\u003e and \u003ccode\u003eremoveAdNetworkExtrasFor:\u003c/code\u003e, enabling ad networks to receive additional parameters.\u003c/p\u003e\n"],["\u003cp\u003eContextual information like keywords and content URL helps tailor ads to the user's current activity and app content for improved targeting and brand safety.\u003c/p\u003e\n"],["\u003cp\u003ePublisher-provided information, including the \u003ccode\u003escene\u003c/code\u003e property, aids in requesting appropriately sized ads within multiscene applications.\u003c/p\u003e\n"],["\u003cp\u003eWhile deprecated, the \u003ccode\u003eadString\u003c/code\u003e property can be used to directly render an ad using a provided ad response string, bypassing other targeting information.\u003c/p\u003e\n"]]],["GADRequest allows for ad request customization. Key actions include: obtaining a default request with `request`, registering, retrieving, and removing ad network extras using `registerAdNetworkExtras:`, `adNetworkExtrasFor:`, and `removeAdNetworkExtrasFor:`. It also allows setting the `scene` for multi-scene apps. Contextual data like `keywords`, `contentURL`, and `neighboringContentURLStrings` can be set. The origin of the ad request can be specified with `requestAgent`, and `customTargeting` key-value pairs are supported. `adString` is deprecated.\n"],null,["GADRequest \n\n\n @interface GADRequest : NSObject \u003cNSCopying\u003e\n\nSpecifies optional parameters for ad requests.\n- `\n ``\n ``\n `\n\n [+request](#/c:objc(cs)GADRequest(cm)request)`\n ` \n Returns a default request. \n\n Declaration \n Objective-C \n\n + (nonnull instancetype)request;\n\n[Additional Parameters For Ad Networks](#/Additional-Parameters-For-Ad-Networks)\n\n- `\n ``\n ``\n `\n\n [-registerAdNetworkExtras:](#/c:objc(cs)GADRequest(im)registerAdNetworkExtras:)`\n ` \n Ad networks may have additional parameters they accept. To pass these parameters to them, create\n the ad network extras object for that network, fill in the parameters, and register it here. The\n ad network should have a header defining the interface for the 'extras' object to create. All\n networks will have access to the basic settings you've set in this GADRequest. If you register\n an extras object that is the same class as one you have registered before, the previous extras\n will be overwritten. \n\n Declaration \n Swift \n\n func register(_ extras: any AdNetworkExtras)\n\n Objective-C \n\n - (void)registerAdNetworkExtras:(nonnull id\u003c../Protocols.html#/c:objc(pl)GADAdNetworkExtras\u003e)extras;\n\n- `\n ``\n ``\n `\n\n [-adNetworkExtrasFor:](#/c:objc(cs)GADRequest(im)adNetworkExtrasFor:)`\n ` \n Returns the network extras defined for an ad network. \n\n Declaration \n Swift \n\n func adNetworkExtras(for aClass: any AdNetworkExtras.Type) -\u003e (any AdNetworkExtras)?\n\n Objective-C \n\n - (nullable id\u003c../Protocols.html#/c:objc(pl)GADAdNetworkExtras\u003e)adNetworkExtrasFor:\n (nonnull Class\u003c../Protocols.html#/c:objc(pl)GADAdNetworkExtras\u003e)aClass;\n\n- `\n ``\n ``\n `\n\n [-removeAdNetworkExtrasFor:](#/c:objc(cs)GADRequest(im)removeAdNetworkExtrasFor:)`\n ` \n Removes the extras for an ad network. \\|aClass\\| is the class which represents that network's\n extras type. \n\n Declaration \n Swift \n\n func removeAdNetworkExtras(for aClass: any AdNetworkExtras.Type)\n\n Objective-C \n\n - (void)removeAdNetworkExtrasFor:(nonnull Class\u003c../Protocols.html#/c:objc(pl)GADAdNetworkExtras\u003e)aClass;\n\n[Publisher Provided](#/Publisher-Provided)\n\n- `\n ``\n ``\n `\n\n [scene](#/c:objc(cs)GADRequest(py)scene)`\n ` \n Scene object. Used in multiscene apps to request ads of the appropriate size. If this is nil,\n uses the application's key window scene. \n\n Declaration \n Swift \n\n weak var scene: UIWindowScene? { get set }\n\n Objective-C \n\n @property (nonatomic, weak, nullable) UIWindowScene *scene;\n\n[Contextual Information](#/Contextual-Information)\n\n- `\n ``\n ``\n `\n\n [keywords](#/c:objc(cs)GADRequest(py)keywords)`\n ` \n Array of keyword strings. Keywords are words or phrases describing the current user activity\n such as @\"Sports Scores\" or @\"Football\". Set this property to nil to clear the keywords. \n\n Declaration \n Swift \n\n var keywords: [String]? { get set }\n\n Objective-C \n\n @property (nonatomic, copy, nullable) NSArray\u003cNSString *\u003e *keywords;\n\n- `\n ``\n ``\n `\n\n [contentURL](#/c:objc(cs)GADRequest(py)contentURL)`\n ` \n URL string for a webpage whose content matches the app's primary content. This webpage content\n is used for targeting and brand safety purposes. \n\n Declaration \n Swift \n\n var contentURL: String? { get set }\n\n Objective-C \n\n @property (nonatomic, copy, nullable) NSString *contentURL;\n\n- `\n ``\n ``\n `\n\n [neighboringContentURLStrings](#/c:objc(cs)GADRequest(py)neighboringContentURLStrings)`\n ` \n URL strings for non-primary web content near an ad. Promotes brand safety and allows displayed\n ads to have an app level rating (MA, T, PG, etc) that is more appropriate to neighboring\n content. \n\n Declaration \n Swift \n\n var neighboringContentURLs: [String]? { get set }\n\n Objective-C \n\n @property (nonatomic, copy, nullable) NSArray\u003cNSString *\u003e *neighboringContentURLStrings;\n\n- `\n ``\n ``\n `\n\n [placementID](#/c:objc(cs)GADRequest(py)placementID)`\n ` \n An identifier for a placement in reporting. A value set here will be set onto any ad returned by\n this request. \n\n Declaration \n Swift \n\n var placementID: Int64 { get set }\n\n Objective-C \n\n @property int64_t placementID;\n\n[Request Agent Information](#/Request-Agent-Information)\n\n- `\n ``\n ``\n `\n\n [requestAgent](#/c:objc(cs)GADRequest(py)requestAgent)`\n ` \n String that identifies the ad request's origin. Third party libraries that reference the Mobile\n Ads SDK should set this property to denote the platform from which the ad request originated.\n For example, a third party ad network called \"CoolAds network\" that is mediating requests to the\n Mobile Ads SDK should set this property as \"CoolAds\". \n\n Declaration \n Swift \n\n var requestAgent: String? { get set }\n\n Objective-C \n\n @property (nonatomic, copy, nullable) NSString *requestAgent;\n\n[Optional Targeting Information](#/Optional-Targeting-Information)\n\n- `\n ``\n ``\n `\n\n [customTargeting](#/c:objc(cs)GADRequest(py)customTargeting)`\n ` \n Key-value pairs used for custom targeting. \n\n Declaration \n Swift \n\n var customTargeting: [String : Any]? { get set }\n\n Objective-C \n\n @property (nonatomic, copy, nullable) NSDictionary\u003cNSString *, id\u003e *customTargeting;\n\n[AdString](#/AdString)\n\n- `\n ``\n ``\n `\n\n [adString](#/c:objc(cs)GADRequest(py)adString)`\n ` \n Deprecated\n\n Use each ad format class's loadWithAdResponseString: instead. \n Deprecated. Use each ad format class's loadWithAdResponseString: instead.\n\n Ad string that represents an ad response. If set, the SDK will render this ad and ignore all\n other targeting information set on this request. \n\n Declaration \n Swift \n\n var adString: String? { get set }\n\n Objective-C \n\n @property (nonatomic, copy, nullable) NSString *adString;"]]