Stay organized with collections
Save and categorize content based on your preferences.
GoogleMobileAds.Api.AdRequest
An AdRequest contains targeting information used to fetch an ad.
Summary
Ad requests are created using AdRequest.Builder.
Inheritance
Direct Known Subclasses:
GoogleMobileAds.Api.AdManager.AdManagerAdRequest
Properties
|
Version
|
static string
Request version string.
|
Public attributes
|
CustomTargeting = new Dictionary()
|
Dictionary< string, string >
The custom targeting parameters.
|
Extras = new Dictionary()
|
Dictionary< string, string >
Returns extra parameters to be sent in the ad request.
|
Keywords = new HashSet()
|
HashSet< string >
Returns targeting information keywords.
|
MediationExtras = new List()
|
Returns extra parameters to be sent to a specific ad partner in the ad request.
|
TestDeviceSimulator = "SIMULATOR"
|
const string
Test device ID used to load test ads.
|
Properties
Version
static string Version
Public attributes
CustomTargeting
Dictionary< string, string > CustomTargeting = new Dictionary<string, string>()
The custom targeting parameters.
Dictionary< string, string > Extras = new Dictionary<string, string>()
Returns extra parameters to be sent in the ad request.
Keywords
HashSet< string > Keywords = new HashSet()
Returns targeting information keywords.
Returns an empty set if no keywords were added.
List< MediationExtras > MediationExtras = new List()
Returns extra parameters to be sent to a specific ad partner in the ad request.
TestDeviceSimulator
const string TestDeviceSimulator = "SIMULATOR"
Test device ID used to load test ads.
.
Public functions
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.
[null,null,["Last updated 2025-08-20 UTC."],[[["\u003cp\u003e\u003ccode\u003eAdRequest\u003c/code\u003e objects contain targeting information used to fetch ads in Google Mobile Ads.\u003c/p\u003e\n"],["\u003cp\u003eAd requests are built using \u003ccode\u003eAdRequest.Builder\u003c/code\u003e and can include extra parameters, keywords, and mediation extras.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eAdRequest\u003c/code\u003e provides a \u003ccode\u003eVersion\u003c/code\u003e property indicating the request version and a \u003ccode\u003eTestDeviceSimulator\u003c/code\u003e for loading test ads.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003eExtras\u003c/code\u003e, \u003ccode\u003eKeywords\u003c/code\u003e, and \u003ccode\u003eMediationExtras\u003c/code\u003e properties allow for customization and targeting within the ad request.\u003c/p\u003e\n"]]],["`AdRequest` objects contain targeting data for fetching ads, created using `AdRequest.Builder`. Key properties include: `CustomTargeting` and `Extras` for custom parameters, `Keywords` for targeting keywords, and `MediationExtras` for partner-specific parameters. `TestDeviceSimulator` designates a test device ID. The `Version` property provides the request version string. The `AdRequest` also includes constructors `AdRequest()` and `AdRequest(AdRequest request)`.\n"],null,["# GoogleMobileAds.Api.AdRequest Class Reference\n\nGoogleMobileAds.Api.AdRequest\n=============================\n\nAn [AdRequest](/admob/unity/reference/class/google-mobile-ads/api/ad-request#class_google_mobile_ads_1_1_api_1_1_ad_request) contains targeting information used to fetch an ad.\n\nSummary\n-------\n\nAd requests are created using AdRequest.Builder.\n\n### Inheritance\n\nDirect Known Subclasses:[GoogleMobileAds.Api.AdManager.AdManagerAdRequest](/admob/unity/reference/class/google-mobile-ads/api/ad-manager/ad-manager-ad-request)\n\n| ### Constructors and Destructors ||\n|---|---|\n| [AdRequest](#class_google_mobile_ads_1_1_api_1_1_ad_request_1acf63ada88122d5c8e8cb884fde1ca7c5)`()` ||\n| [AdRequest](#class_google_mobile_ads_1_1_api_1_1_ad_request_1a2eb9ce1d9f0b00ea8e5865515790864f)`(`[AdRequest](/admob/unity/reference/class/google-mobile-ads/api/ad-request#class_google_mobile_ads_1_1_api_1_1_ad_request)` request)` ||\n\n| ### Properties ||\n|-----------------------------------------------------------------------------------------------|-----------------------------------------|\n| [Version](#class_google_mobile_ads_1_1_api_1_1_ad_request_1af3d2eb410a4afa8c77a0d57e6479ac02) | `static string` Request version string. |\n\n| ### Public attributes ||\n|----------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [CustomTargeting](#class_google_mobile_ads_1_1_api_1_1_ad_request_1aa5cf54d0d56b27ba5d9646d2d9949ad1)` = new Dictionary`() | `Dictionary\u003c string, string \u003e` The custom targeting parameters. |\n| [Extras](#class_google_mobile_ads_1_1_api_1_1_ad_request_1a374764c1c8a4dccb0b507dd61c2f2c48)` = new Dictionary`() | `Dictionary\u003c string, string \u003e` Returns extra parameters to be sent in the ad request. |\n| [Keywords](#class_google_mobile_ads_1_1_api_1_1_ad_request_1a34228aa1b15bc68ea9dd27ca79677fb4)` = new HashSet`() | `HashSet\u003c string \u003e` Returns targeting information keywords. |\n| [MediationExtras](#class_google_mobile_ads_1_1_api_1_1_ad_request_1acec387ff6d813d8e80eaa93a445c6cf5)` = new List`() | `List\u003c `[MediationExtras](/admob/unity/reference/class/google-mobile-ads/api/mediation/mediation-extras#class_google_mobile_ads_1_1_api_1_1_mediation_1_1_mediation_extras)` \u003e` Returns extra parameters to be sent to a specific ad partner in the ad request. |\n| [TestDeviceSimulator](#class_google_mobile_ads_1_1_api_1_1_ad_request_1a1b00beb73dae7b0389e50844b38243f3)` = \"SIMULATOR\"` | `const string` Test device ID used to load test ads. |\n\nProperties\n----------\n\n### Version\n\n```c#\nstatic string Version\n``` \nRequest version string.\n\nPublic attributes\n-----------------\n\n### CustomTargeting\n\n```c#\nDictionary\u003c string, string \u003e CustomTargeting = new Dictionary\u003cstring, string\u003e()\n``` \nThe custom targeting parameters. \n\n### Extras\n\n```c#\nDictionary\u003c string, string \u003e Extras = new Dictionary\u003cstring, string\u003e()\n``` \nReturns extra parameters to be sent in the ad request. \n\n### Keywords\n\n```c#\nHashSet\u003c string \u003e Keywords = new HashSet()\n``` \nReturns targeting information keywords.\n\nReturns an empty set if no keywords were added. \n\n### MediationExtras\n\n```c#\nList\u003c MediationExtras \u003e MediationExtras = new List()\n``` \nReturns extra parameters to be sent to a specific ad partner in the ad request. \n\n### TestDeviceSimulator\n\n```c#\nconst string TestDeviceSimulator = \"SIMULATOR\"\n``` \nTest device ID used to load test ads.\n\n.\n\nPublic functions\n----------------\n\n### AdRequest\n\n```c#\n AdRequest()\n``` \n\n### AdRequest\n\n```c#\n AdRequest(\n AdRequest request\n)\n```"]]