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\u003eAn AdRequest object contains targeting information used to fetch an ad and is created using AdRequest.Builder.\u003c/p\u003e\n"],["\u003cp\u003eIt includes properties like Keywords for targeting, Extras for additional parameters, and MediationExtras for specific ad partners.\u003c/p\u003e\n"],["\u003cp\u003eAdRequest provides access to the request version string and a test device ID for loading test ads.\u003c/p\u003e\n"],["\u003cp\u003eYou can add keywords, extra parameters, and mediation extras to customize ad requests.\u003c/p\u003e\n"]]],[],null,["# GoogleMobileAds.Api.AdRequest Class Reference\n\nGoogleMobileAds.Api.AdRequest\n=============================\n\nAn [AdRequest](/ad-manager/mobile-ads-sdk/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](/ad-manager/mobile-ads-sdk/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](/ad-manager/mobile-ads-sdk/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](/ad-manager/mobile-ads-sdk/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```"]]