# firebase::gma::AdRequest


`#include <types.h>`

Contains targeting information used to fetch an ad.

## Summary

| ### Constructors and Destructors ||
|---|---|
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-request#classfirebase_1_1gma_1_1_ad_request_1af3547b7db4bf5fdf22b0c373aea5efff()` Creates an [AdRequest](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-request#classfirebase_1_1gma_1_1_ad_request) with no custom configuration. ||
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-request#classfirebase_1_1gma_1_1_ad_request_1aeff46a25d8e0dea069e6dbd47b2bd341(const char *content_url)` Creates an [AdRequest](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-request#classfirebase_1_1gma_1_1_ad_request) with the optional content URL. ||
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-request#classfirebase_1_1gma_1_1_ad_request_1a6d1e4f29ce631518907dfd2ebb47b176()` ||

| ### Public functions ||
|---|---|
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-request#classfirebase_1_1gma_1_1_ad_request_1a8c1b8d993e187b5cff8406c387d29939(const char *adapter_class_name, const char *extra_key, const char *extra_value)` | `void` Add a network extra for the associated ad mediation adapter. |
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-request#classfirebase_1_1gma_1_1_ad_request_1ade836aed5a4e0b41dec5b44dab2557ea(const char *keyword)` | `void` Adds a keyword for targeting purposes. |
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-request#classfirebase_1_1gma_1_1_ad_request_1aeb0010c4c4984d56f300c2f6f2646472(const std::vector< std::string > & neighboring_content_urls)` | `void` Adds to the list of URLs which represent web content near an ad. |
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-request#classfirebase_1_1gma_1_1_ad_request_1a04ca690e1e4a69b5b07b2b12f8bdef85() const ` | `const std::string &` The content URL targeting information. |
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-request#classfirebase_1_1gma_1_1_ad_request_1af8ce3b3efb73abfd6da32bf21e8ed4fd() const ` | `const std::map< std::string, std::map< std::string, std::string > > &` A Map of adapter class names to their collection of extra parameters, as configured via [add_extra](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-request#classfirebase_1_1gma_1_1_ad_request_1a8c1b8d993e187b5cff8406c387d29939). |
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-request#classfirebase_1_1gma_1_1_ad_request_1a4b979fe54fe99ce8f6f467bd831a1a36() const ` | `const std::unordered_set< std::string > &` Keywords which will help GMA to provide targeted ads, as added by [add_keyword](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-request#classfirebase_1_1gma_1_1_ad_request_1ade836aed5a4e0b41dec5b44dab2557ea). |
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-request#classfirebase_1_1gma_1_1_ad_request_1ab35990cad461debddcc24a43bcd5db44() const ` | `const std::unordered_set< std::string > &` Returns the set of neighboring content URLs or an empty set if no URLs were set via [add_neighboring_content_urls()](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-request#classfirebase_1_1gma_1_1_ad_request_1aeb0010c4c4984d56f300c2f6f2646472). |
| `https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-request#classfirebase_1_1gma_1_1_ad_request_1a7e9dbe28d7748d17448ad875008726c6(const char *content_url)` | `void` When requesting an ad, apps may pass the URL of the content they are serving. |

## Public functions

### AdRequest

```c++
 AdRequest()
```
Creates an [AdRequest](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-request#classfirebase_1_1gma_1_1_ad_request) with no custom configuration.

### AdRequest

```c++
 AdRequest(
  const char *content_url
)
```
Creates an [AdRequest](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-request#classfirebase_1_1gma_1_1_ad_request) with the optional content URL.

When requesting an ad, apps may pass the URL of the content they are serving. This enables keyword targeting to match the ad with the content.

The URL is ignored if null or the number of characters exceeds 512.

<br />

Details Parameters `content_url` the url of the content being viewed.

### add_extra

```c++
void add_extra(
  const char *adapter_class_name,
  const char *extra_key,
  const char *extra_value
)
```
Add a network extra for the associated ad mediation adapter.

Appends an extra to the corresponding list of extras for the ad mediation adapter. Each ad mediation adapter can have multiple extra strings.

<br />

Details Parameters `adapter_class_name` the class name of the ad mediation adapter for which to add the extra. `extra_key` a key which will be passed to the corresponding ad mediation adapter. `extra_value` the value associated with extra_key.

### add_keyword

```c++
void add_keyword(
  const char *keyword
)
```
Adds a keyword for targeting purposes.

Multiple keywords may be added via repeated invocations of this method.

<br />

Details Parameters `keyword` a string that GMA will use to aid in targeting ads.

### add_neighboring_content_urls

```c++
void add_neighboring_content_urls(
  const std::vector< std::string > & neighboring_content_urls
)
```
Adds to the list of URLs which represent 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.

Subsequent invocations append to the existing list.

<br />

Details Parameters `neighboring_content_urls` neighboring content URLs to be attached to the existing neighboring content URLs.

### content_url

```c++
const std::string & content_url() const 
```
The content URL targeting information.

<br />

| Details ||
|---|---|
| **Returns** | the content URL for the [AdRequest](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-request#classfirebase_1_1gma_1_1_ad_request). The string will be empty if no content URL has been configured. |

### extras

```c++
const std::map< std::string, std::map< std::string, std::string > > & extras() const 
```
A Map of adapter class names to their collection of extra parameters, as configured via [add_extra](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-request#classfirebase_1_1gma_1_1_ad_request_1a8c1b8d993e187b5cff8406c387d29939).

### keywords

```c++
const std::unordered_set< std::string > & keywords() const 
```
Keywords which will help GMA to provide targeted ads, as added by [add_keyword](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-request#classfirebase_1_1gma_1_1_ad_request_1ade836aed5a4e0b41dec5b44dab2557ea).

### neighboring_content_urls

```c++
const std::unordered_set< std::string > & neighboring_content_urls() const 
```
Returns the set of neighboring content URLs or an empty set if no URLs were set via [add_neighboring_content_urls()](https://developers.google.com/admob/cpp/reference/class/firebase/gma/ad-request#classfirebase_1_1gma_1_1_ad_request_1aeb0010c4c4984d56f300c2f6f2646472).

### set_content_url

```c++
void set_content_url(
  const char *content_url
)
```
When requesting an ad, apps may pass the URL of the content they are serving.

This enables keyword targeting to match the ad with the content.

The URL is ignored if null or the number of characters exceeds 512.

<br />

Details Parameters `content_url` the url of the content being viewed.

### \~AdRequest

```c++
 ~AdRequest()
```