firebase::gma::AdRequest

#include <types.h>

Contains targeting information used to fetch an ad.

Summary

Constructors and Destructors

AdRequest()
Creates an AdRequest with no custom configuration.
AdRequest(const char *content_url)
Creates an AdRequest with the optional content URL.
~AdRequest()

Public functions

add_extra(const char *adapter_class_name, const char *extra_key, const char *extra_value)
void
Add a network extra for the associated ad mediation adapter.
add_keyword(const char *keyword)
void
Adds a keyword for targeting purposes.
add_neighboring_content_urls(const std::vector< std::string > & neighboring_content_urls)
void
Adds to the list of URLs which represent web content near an ad.
content_url() const
const std::string &
The content URL targeting information.
extras() 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.
keywords() const
const std::unordered_set< std::string > &
Keywords which will help GMA to provide targeted ads, as added by add_keyword.
neighboring_content_urls() 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().
set_content_url(const char *content_url)
void
When requesting an ad, apps may pass the URL of the content they are serving.

Public functions

AdRequest

 AdRequest()

Creates an AdRequest with no custom configuration.

AdRequest

 AdRequest(
  const char *content_url
)

Creates an AdRequest 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.

Details
Parameters
content_url
the url of the content being viewed.

add_extra

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.

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

void add_keyword(
  const char *keyword
)

Adds a keyword for targeting purposes.

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

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

add_neighboring_content_urls

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.

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

content_url

const std::string & content_url() const 

The content URL targeting information.

Details
Returns
the content URL for the AdRequest. The string will be empty if no content URL has been configured.

extras

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.

keywords

const std::unordered_set< std::string > & keywords() const 

Keywords which will help GMA to provide targeted ads, as added by add_keyword.

neighboring_content_urls

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().

set_content_url

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.

Details
Parameters
content_url
the url of the content being viewed.

~AdRequest

 ~AdRequest()