To discuss and provide feedback on our products, join the official AdMob Discord channel in the Google Advertising and Measurement Community server.

GoogleMobileAds Framework Reference

  • GADMediationAdRequest provides information for making ad requests during mediation.

  • It includes the publisher ID and mediation configurations set on the AdMob frontend.

  • The request can indicate if test ads are being requested or if child directed treatment is enabled.

  • It allows specification of the maximum ad content rating and whether the user is under the age of consent.

  • User keywords describing the user's current activity can also be included.

GADMediationAdRequest

@protocol GADMediationAdRequest <NSObject>

Provides information which can be used for making ad requests during mediation.

  • Publisher ID set by the publisher on the AdMob frontend.

    Declaration

    Swift

    func publisherId() -> String?

    Objective-C

    - (nullable NSString *)publisherId;
  • Mediation configurations set by the publisher on the AdMob frontend.

    Declaration

    Swift

    func credentials() -> [AnyHashable : Any]?

    Objective-C

    - (nullable NSDictionary *)credentials;
  • Returns YES if the publisher is requesting test ads.

    Declaration

    Swift

    func testMode() -> Bool

    Objective-C

    - (BOOL)testMode;
  • The adapter’s ad network extras specified in GADRequest.

    Declaration

    Swift

    func networkExtras() -> (any AdNetworkExtras)?

    Objective-C

    - (nullable id<GADAdNetworkExtras>)networkExtras;
  • Returns the value of childDirectedTreatment supplied by the publisher. Returns nil if the publisher hasn’t specified child directed treatment. Returns @YES if child directed treatment is enabled.

    Declaration

    Swift

    func childDirectedTreatment() -> NSNumber?

    Objective-C

    - (nullable NSNumber *)childDirectedTreatment;
  • Returns the maximum ad content rating supplied by the publisher. Returns nil if the publisher hasn’t specified a max ad content rating.

    Declaration

    Swift

    func maxAdContentRating() -> GADMaxAdContentRating?

    Objective-C

    - (nullable GADMaxAdContentRating)maxAdContentRating;
  • Returns the value of underAgeOfConsent supplied by the publisher. Returns nil if the publisher hasn’t specified the user is under the age of consent. Returns @YES if the user is under the age of consent.

    Declaration

    Swift

    func underAgeOfConsent() -> NSNumber?

    Objective-C

    - (nullable NSNumber *)underAgeOfConsent;
  • Keywords describing the user’s current activity. Example: @“Sport Scores”.

    Declaration

    Swift

    func userKeywords() -> [Any]?

    Objective-C

    - (nullable NSArray *)userKeywords;

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.