public class AdRequest

  1. Object
  2. AdRequest

Optional targeting metadata attached to an ad load. Build one with the fluent setters and pass it to a load method, or omit it entirely to load with defaults:

interstitial.load(new AdRequest()
        .addKeyword("games")
        .contentUrl("https://example.com/level"));

An AdRequest is immutable once a load begins; reuse or discard freely.

Constructors

public AdRequest()

Methods

public AdRequest addKeyword(String keyword)Adds a keyword used to target the ad.
public List<String> getKeywords()The keywords associated with this request, never null.
public String getKeywordString()The keywords as a comma separated string, used by native bridges.
public AdRequest contentUrl(String contentUrl)Sets a URL describing the content the ad will appear next to, used for brand safety and contextual targeting.
public String getContentUrl()The content URL associated with this request, may be null.
public AdRequest nonPersonalized(boolean nonPersonalized)Requests non-personalized ads regardless of the user’s consent state.
public boolean isNonPersonalized()True when non personalized ads were explicitly requested.

Inherited methods

Constructor details

AdRequest

public AdRequest()

Method details

addKeyword

public AdRequest addKeyword(String keyword)
Adds a keyword used to target the ad.

Parameters

keyword String
a keyword describing the current content

Returns

this request for chaining

getKeywords

public List<String> getKeywords()
The keywords associated with this request, never null.

getKeywordString

public String getKeywordString()
The keywords as a comma separated string, used by native bridges. Returns an empty string when no keywords were set.

contentUrl

public AdRequest contentUrl(String contentUrl)
Sets a URL describing the content the ad will appear next to, used for brand safety and contextual targeting.

Parameters

contentUrl String
the URL of the surrounding content

Returns

this request for chaining

getContentUrl

public String getContentUrl()
The content URL associated with this request, may be null.

nonPersonalized

public AdRequest nonPersonalized(boolean nonPersonalized)
Requests non-personalized ads regardless of the user’s consent state. This is normally driven automatically by AdConsent; set it explicitly only when you have your own consent mechanism.

Parameters

nonPersonalized boolean
true to request non personalized ads

Returns

this request for chaining

isNonPersonalized

public boolean isNonPersonalized()
True when non personalized ads were explicitly requested.