AATKit iOS Integration
Release Notes
  • Start
    • Setup
      • Minimum iOS Version
      • Cocoapods
      • Swift Package Manager
      • AATKit Reporting
      • App Transport Security (ATS)
      • SKAdNetwork
    • Initialization
    • Consent
      • General Handling
      • Managed Consent
        • Google CMP
        • Sourcepoint CMP
        • SFBX (AppConsent) CMP
      • Vendor Consent
      • Simple Consent
    • Plugins documentation
    • Additional Information
  • Formats
    • Introduction
    • Banner
      • Auto Load Banner
      • Multi-Size Auto Load Banner
      • Banner Cache
      • Infeed Banner
      • Asynchronous Infeed Banner
      • Sticky Banner
      • Multi-Size Banner
    • Fullscreen (Interstitial)
    • AppOpen (Google)
    • Rewarded Video
      • Server-Side Verification (SSV)
    • Native Ad
      • Basic Integration
      • Asynchronous Basic Integration
      • Network Specifics
        • Native Ads: Google
        • Native Ads: Applovin
  • Ad Networks
    • Customize Ad Networks
    • Privacy Requirements
    • Google Mobile Ads SDK
    • AppNexus Custom Interstitial Auto Dismiss Delay
    • FeedAd Banner Options
    • AmazonHB
  • Advanced
    • Targeting
      • Key-Value Targeting
      • User Targeting
      • Content Targeting URL
    • Frequency Capping
    • Advanced Delegates
      • Reports Delegate
      • Impression Delegate (ILRD)
      • Statistics Delegate
    • AATKit's Size
    • Ad Space and Fill Rate
    • Shake Debug
    • Publisher Provided ID
    • Child-directed Support
    • Disabling Ad Networks
    • Geo Tracking
    • Ad Quality
    • Creatives History
  • Other
    • AdMob Custom Events
    • Datonomy
    • Reference
      • Classes
        • AATConfiguration
        • AATRuntimeConfiguration
        • AATManagedConsent
        • AATVendorConsent
        • AATSimpleConsent
        • AATAdInfo
        • AATBannerConfiguration
        • AATBannerRequest
        • AATBannerCacheConfiguration
        • AATBannerAlign
        • AATPlacementHistoryInfo
        • AATReward
        • AATRewardedAdSSVInfo
        • AATNativeAdRating
        • AATImpression
        • AATPriceInfo
        • AATAdNetworksOptions
          • AATAppNexusOptions
          • AATFeedAdOptions
          • AATAdMobOptions
          • AATDFPOptions
          • AATDatonomyOptions
        • AATDebugInfo
        • AATDebugScreenConfiguration
        • AATUserTargeting
        • AATCollapsibleBannerOptions
      • Protocols
        • AATDelegate
        • AATManagedConsentDelegate
        • AATVendorConsentDelegate
        • AATPlacement
        • AATStickyBannerPlacement
        • AATStickyBannerPlacementDelegate
        • AATMultiSizeBannerPlacement
        • AATMultiSizeBannerPlacementDelegate
        • AATInfeedBannerPlacement
        • AATInfeedBannerPlacementDelegate
        • AATAsyncInfeedBannerPlacement
        • AATBannerRequestDelegate
        • AATBannerCache
        • AATBannerCacheDelegate
        • AATBannerCacheStatusDelegate
        • AATAutoLoadBannerPlacement
        • AATAutoLoadBannerPlacementDelegate
        • AATAutoLoadMultiSizeBannerPlacement
        • AATAutoLoadMultiSizeBannerPlacementDelegate
        • AATFullscreenPlacement
        • AATFullscreenPlacementDelegate
        • AATAppOpenAdPlacement
        • AATAppOpenPlacementDelegate
        • AATRewardedVideoPlacement
        • AATRewardedVideoPlacementDelegate
        • AATNativeAdPlacement
        • AATNativePlacementDelegate
        • AATAsyncNativeAdPlacement
        • AATNativeAdData
        • AATReportsDelegate
        • AATImpressionDelegate
        • AATStatisticsDelegate
      • Enumerations
        • AATAdNetwork
        • AATGender
        • AATLogLevel
        • AATManagedConsentState
        • NonIABConsent
        • AATBannerPlacementSize
        • AATBannerSize
        • HorizontalAlign
        • VerticalAlign
        • AATMediationType
        • AATImpressionPricePrecisionType
  • Samples
Powered by GitBook
On this page
  • Requirements
  • Usage
  1. Start
  2. Consent
  3. Managed Consent

Google CMP

Handle consent using Google User Messaging Platform

Last updated 1 month ago

Requirements

  • Obtain a Google app ID by following the .

  • Set the Google appID in the Info.plist file:

<key>GADApplicationIdentifier</key>
<string>YOUR-APP-ID</string>
  • Integrate GoogleCMP:

    • Cocoapods:

      • Add pod 'AATKit/GoogleCMP' to your Podfile.

    • Swift Package Manager:

      • Follow the same SPM steps .

      • Repeat the last step, and add AATKit-GoogleCMP.

Usage

  • Create an instance of AATCMPGoogle (AATCMPGoogle conforms to AATCMPProtocol).

  • Pass the created AATCMPGoogle instance while initializing the AATManagedConsent using the public init?(cmp: AATCMPProtocol?, delegate: AATManagedConsentDelegate) method.

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {
    ...
    func configureAATKit() {
        let configuration = AATConfiguration()
        configuration.delegate = self
        let cmp = AATCMPGoogle()
        var consent = AATManagedConsent(cmp: cmp, delegate: self)
        configuration.consent = consent
        AATSDK.initAATKit(with: configuration)
        consent?.showIfNeeded(<ROOT VIEW CONTROLLER>)
        OR
        consent?.showIfNeededOrRejected(daysAgo: 1, viewController: <ROOT VIEW CONTROLLER>)
    }
    ...
}

// MARK: - AATManagedConsentDelegate
extension AppDelegate: AATManagedConsentDelegate {
    func managedConsentNeedsUserInterface(_ managedConsent: AATManagedConsent) {
        // CMP is loaded and ready to be shown
        // Show the CMP using the root view controller
        managedConsent.showIfNeeded(<ROOT VIEW CONTROLLER>)
    }

    func managedConsentCMPFinished(with state: AATManagedConsentState) {
      // The user finished his action with CMP with the state as the user chosen state
    }

    func managedConsentCMPFailedToLoad(_ managedConsent: AATManagedConsent, with error: String) {
        // CMP failed to load with the error message.
        // Consider reloading the CMP using the active view controller:
        // managedConsent.reload(<ROOT VIEW CONTROLLER>)
        // if you know that the user is in GDPR region
    }

    func managedConsentCMPFailedToShow(_ managedConsent: AATManagedConsent, with error: String) {
        // CMP failed to show with the error message
    }
}
@implementation AppDelegate
...
- (void)configureAATKit {
    AATConfiguration *configuration = [[AATConfiguration alloc] init];
    configuration.delegate = self;
    AATCMPGoogle *cmp = [[AATCMPGoogle alloc] init];
    AATManagedConsent *consent = [[AATManagedConsent alloc] initWithCmp:cmp delegate:self];
    configuration.consent = consent;
    [AATSDK initAATKitWith:configuration];
    [consent showIfNeeded:<ROOT VIEW CONTROLLER>];
    OR
    [self.consent showIfNeededOrRejectedWithDaysAgo:1 viewController:<ROOT VIEW CONTROLLER>];
}
...
#pragma mark - AATManagedConsentDelegate
- (void)managedConsentNeedsUserInterface:(AATManagedConsent * _Nonnull)managedConsent {
    // CMP is loaded and ready to be shown
    // Show the CMP using the root view controller
    [managedConsent showIfNeeded:<ROOT VIEW CONTROLLER>];
}

- (void)managedConsentCMPFinishedWith:(enum AATManagedConsentState)state {
    // The user finished his action with CMP with the state as the user chosen state
}

- (void)managedConsentCMPFailedToLoad:(AATManagedConsent * _Nonnull)managedConsent with:(NSString * _Nonnull)error {
    // CMP failed to load with the error message.
    // Consider reloading the CMP using the active view controller:
    // [managedConsent reload:<ROOT VIEW CONTROLLER>];
    // if you know that the user is in GDPR region
}

- (void)managedConsentCMPFailedToShow:(AATManagedConsent * _Nonnull)managedConsent with:(NSString * _Nonnull)error {
    // CMP failed to show with the error message
}
@end

Make sure, your Google CMP has been set up at its backend dashboard. Our support recommends certain vendors to be included in your server-side setup in order to yield optimal revenues. We also recommend that CMP should be geographically targeted to "Everywhere", for handling of opt-out consent scenarios. Please also refer to your .

Follow the instructions in the Managed Consent .

Google CMP’s documentation
introduction section
Google Funding Choices Help Center instructions
here