> ## Documentation Index
> Fetch the complete documentation index at: https://docs.adrop.io/llms.txt
> Use this file to discover all available pages before exploring further.

# UMP Integration

> Integrate Google UMP for GDPR/CCPA compliance on iOS

## Overview

The User Messaging Platform (UMP) SDK helps you manage user consent for personalized advertising in compliance with GDPR (General Data Protection Regulation) and CCPA (California Consumer Privacy Act).

<Note>
  UMP integration requires the `adrop-ads-backfill` module. Make sure you have completed the [Getting Started](/sdk/ios/overview) installation guide first.
</Note>

***

## Basic Usage

Use the Consent Manager to request user consent after initializing Adrop.

<CodeGroup>
  ```swift Swift theme={null}
  import AdropAds

  class ViewController: UIViewController {

      override func viewDidLoad() {
          super.viewDidLoad()

          // Call after Adrop.initialize()
          Adrop.consentManager?.requestConsentInfoUpdate(from: self) { result in
              if let error = result.error {
                  print("Consent error: \(error)")
              }
          }
      }
  }
  ```

  ```objc Objective-C theme={null}
  @import AdropAds;

  @implementation ViewController

  - (void)viewDidLoad {
      [super viewDidLoad];

      // Call after Adrop.initialize()
      if (Adrop.consentManager != nil) {
          [Adrop.consentManager requestConsentInfoUpdateFrom:self completion:^(AdropConsentResult *result) {
              if (result.error != nil) {
                  NSLog(@"Consent error: %@", result.error);
              }
          }];
      }
  }

  @end
  ```
</CodeGroup>

***

## Consent Result

The `requestConsentInfoUpdate` callback returns an `AdropConsentResult` object with the following properties:

| Property                 | Type                 | Description                           |
| ------------------------ | -------------------- | ------------------------------------- |
| `status`                 | `AdropConsentStatus` | Current consent status                |
| `canRequestAds`          | `Bool`               | Whether ads can be requested          |
| `canShowPersonalizedAds` | `Bool`               | Whether personalized ads can be shown |
| `error`                  | `Error?`             | Error if the request failed           |

<CodeGroup>
  ```swift Swift theme={null}
  Adrop.consentManager?.requestConsentInfoUpdate(from: self) { result in
      print("Status: \(result.status)")
      print("Can request ads: \(result.canRequestAds)")
      print("Can show personalized ads: \(result.canShowPersonalizedAds)")

      if let error = result.error {
          print("Error: \(error)")
      }
  }
  ```

  ```objc Objective-C theme={null}
  [Adrop.consentManager requestConsentInfoUpdateFrom:self completion:^(AdropConsentResult *result) {
      NSLog(@"Status: %ld", (long)result.status);
      NSLog(@"Can request ads: %d", result.canRequestAds);
      NSLog(@"Can show personalized ads: %d", result.canShowPersonalizedAds);

      if (result.error != nil) {
          NSLog(@"Error: %@", result.error);
      }
  }];
  ```
</CodeGroup>

***

## Consent Status

The consent manager returns one of the following statuses:

| Status        | Description                            |
| ------------- | -------------------------------------- |
| `unknown`     | Consent status not yet determined      |
| `required`    | Consent required (popup will be shown) |
| `notRequired` | Consent not required (non-GDPR region) |
| `obtained`    | Consent already obtained               |

***

## Debug Settings (Test Mode)

Test GDPR/CCPA consent flows during development:

<CodeGroup>
  ```swift Swift theme={null}
  import AdropAds

  #if DEBUG
  // Set debug geography before requesting consent
  Adrop.consentManager?.setDebugSettings(
      testDeviceIdentifiers: ["YOUR_DEVICE_IDENTIFIER"],  // Check Xcode console
      geography: .EEA  // Test GDPR
  )

  // Reset consent for testing
  Adrop.consentManager?.reset()
  #endif
  ```

  ```objc Objective-C theme={null}
  @import AdropAds;

  #ifdef DEBUG
  // Set debug geography before requesting consent
  [Adrop.consentManager setDebugSettingsWithTestDeviceIdentifiers:@[@"YOUR_DEVICE_IDENTIFIER"]
                                                        geography:AdropConsentDebugGeographyEEA];

  // Reset consent for testing
  [Adrop.consentManager reset];
  #endif
  ```
</CodeGroup>

### Debug Geographies

| Geography          | Description                        |
| ------------------ | ---------------------------------- |
| `disabled`         | Use actual device location         |
| `EEA`              | Test GDPR (European Economic Area) |
| `regulatedUSState` | Test CCPA (California, etc.)       |
| `other`            | Test non-regulated regions         |

<Warning>
  Debug settings should only be used during development. Remove or disable them before releasing to production.
</Warning>

***

## Additional Methods

| Method               | Return Type          | Description                                           |
| -------------------- | -------------------- | ----------------------------------------------------- |
| `getConsentStatus()` | `AdropConsentStatus` | Returns the current consent status                    |
| `canRequestAds()`    | `Bool`               | Returns whether ads can be requested based on consent |
| `reset()`            | `Void`               | Resets consent information                            |

```swift theme={null}
// Check consent status independently
if let status = Adrop.consentManager?.getConsentStatus() {
    switch status {
    case .obtained:
        print("Consent obtained")
    case .required:
        print("Consent required")
    case .notRequired:
        print("Consent not required")
    case .unknown:
        print("Consent status unknown")
    }
}

// Check if ads can be requested
if Adrop.consentManager?.canRequestAds() == true {
    // Load ads
}

// Reset consent (for testing)
Adrop.consentManager?.reset()
```

***

## Best Practices

<CardGroup cols={2}>
  <Card title="Request Early" icon="clock">
    Request consent as early as possible in your app lifecycle, ideally right after SDK initialization.
  </Card>

  <Card title="Handle Errors" icon="triangle-exclamation">
    Always handle consent errors gracefully and provide fallback behavior.
  </Card>

  <Card title="Test All Scenarios" icon="vial">
    Use debug settings to test all consent scenarios (required, not required, obtained) before release.
  </Card>

  <Card title="Respect User Choice" icon="user-check">
    Once consent is obtained or declined, respect the user's choice and don't repeatedly ask.
  </Card>
</CardGroup>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Targeting" icon="bullseye" href="/sdk/ios/targeting">
    Set up user and context targeting
  </Card>

  <Card title="Getting Started" icon="rocket" href="/sdk/ios/overview">
    SDK installation and setup guide
  </Card>

  <Card title="Reference" icon="book" href="/sdk/ios/reference">
    Classes, delegates, and error codes
  </Card>
</CardGroup>
