> For the complete documentation index, see [llms.txt](https://madex.gitbook.io/madex-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://madex.gitbook.io/madex-documentation/ios-sdk/user-consent-screen.md).

# User Consent Screen

Library for demonstrating a ready-made consent screen for the collection, processing, and usage of user data.

Release Version **1.0.6** | Release Date **09/29/2025**

{% hint style="info" %}
Minimum requirements:

* iOS 13.0 and above.
* Use Xcode 13 and above.
  {% endhint %}

{% hint style="warning" %}
The information provided below is not legal advice. Madex is not responsible for the consequences of its use. Before making legally significant decisions, it is recommended to consult with a lawyer.
{% endhint %}

## General Information

To comply with the requirements of app stores and laws regulating the collection, processing, and usage of user personal data, obtaining the user's consent for the mentioned actions is required. If refused, no user data should be collected.

In addition to user consent, you will need to properly prepare a privacy policy and other documents required by app stores and the laws of the countries where your app is published.

Clear consent for the collection, processing, and usage of user data is required by most countries. Here are a few key documents describing this process:

* GDPR (General Data Protection Regulation, Regulation (European Union) 2016/679)
* COPPA (Children's Online Privacy Protection Rule)
* CCPA (California Consumer Privacy Act)

{% hint style="warning" %}
Please note that this list is not exhaustive. It is recommended to study the legislation regulating user personal data in the countries where your app is published and consult with a lawyer before making legally significant decisions.
{% endhint %}

## Consent screen and Consent Manager

Usually, user consent is obtained on a special screen during the first launch of the app — the consent screen.

Madex SDK implements such a screen, and you can add and customize it using the **Consent Manager** library. You can use it to avoid creating the Consent Screen yourself.

## Demo Application

Use our demo application as an example.

{% embed url="<https://github.com/MadexTech/madex-ios-demo>" %}

## Installation&#x20;

### Configure Podfile

1. Install Madex SDK. Detailed installation process is described in the [corresponding section](/madex-documentation/ios-sdk/installing-and-configuring-the-sdk.md).
2. Add the dependency for installing Consent Manager to the `Podfile` file.

```ruby
platform :ios, '13.0'

target 'Sample' do
    use_frameworks!

    # connection of Consent Manager SDK dependency
    pod 'MadexConsentManager', "1.0.6"
end
```

3. Save the file and run pod install in the terminal in the project folder.
4. Run the command `pod install` in the terminal to install the dependencies.

{% hint style="info" %}
Use the `pod update` command to update dependencies
{% endhint %}

## Setting up Consent Manager

Before using the user consent screen, it needs to be configured.

To set parameters, call the methods of the `builder` variable. Below is a list of all available settings:

* `appendPolicyURL` - sets the link to your app's privacy policy. Consider this parameter as mandatory. Links to Madex's and our partners' privacy policies are already added to the consent screen.
* `appendBundle` - sets a custom Bundle used to set the app's icon in the TopBar of the user consent screen. If the parameter is not filled, the existing app icon will be displayed.
* `appendName` - sets the name of your app in the TopBar of the user consent screen. If the parameter is not filled, the existing app name will be displayed.
* `appendGDPR` - adds a button for refusing data collection.\
  \
  Consent screen with one button: the option to refuse data collection is available to the user only through device settings.<br>

  <div align="left"><figure><img src="https://626582791-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwiiOaJhSveT4OR9bjTvw%2Fuploads%2Fj3AE5vNw4XA4uWQB2Gsk%2F2023-12-08%2013.20.14.jpg?alt=media&amp;token=e4a38abc-091c-4431-be43-1b7663491e20" alt="" width="148"><figcaption></figcaption></figure></div>

  \
  Consent screen with two buttons: the option to refuse data collection is available to the user by tapping the "No thanks" button.<br>

  <div align="left"><figure><img src="https://626582791-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FwiiOaJhSveT4OR9bjTvw%2Fuploads%2FavW3VTY2o97ZUcD9ANrO%2F2023-12-08%2013.20.12.jpg?alt=media&amp;token=7076b96b-e2bc-49b3-a9f2-aed3851c80c9" alt="" width="148"><figcaption></figcaption></figure></div>

Take a look at the complete example of setting parameters:

```swift
ConsentManager.registerCustomVendor { builder in
    let _ = builder
        .appendPolicyURL("https://madex.me/privacy-policies")
        .appendBundle("me.madex.ads.app")
        .appendName("Example name")
}
```

## Working with Consent Manager

### Initialization

We recommend calling SDK initialization in your `ViewController` - in the `viewDidLoad` method

```swift
override func viewDidLoad() {
    ConsentManager.loadManager()
}
```

### Displaying the Permissions Request Screen

To display the screen, call the `showConsentWindow` method.

```swift
ConsentManager.showConsentWindow(self)
```

### Checking the User's Consent Status

If the user has given consent to data collection, the method will return `true`.

```swift
ConsentManager.hasConsent
```

If the method returns `false`, it is strongly recommended not to collect any data about this user.

### Updating the User's Consent Status (SDK method for advertising)

To update the consent status in the Madex SDK (for advertising purposes), use the `setUserConsent` method.

```swift
Madex.setUserConsent(ConsentManager.hasConsent)
```

Other Madex SDK methods (for working with ads) can be found in the [corresponding section](/madex-documentation/ios-sdk/working-with-advertising.md#sdk-methods).

### Debug Mode

If you need error and event logging, enable debug mode.\
By default, it is turned off.

To enable debug mode, use the `enableDebug` method.

```swift
ConsentManager.enableLog(true)
```

### Event Tracking

Consent Manager allows you to track events related to user consent for data collection.

**To track events, do the following:**

1. Create an extension for `ViewController` and inherit it from the interface for event tracking.

```swift
extension YourViewController: ConsentDelegate {
    
    func onConsentManagerLoaded() {
       // Called when the manager is ready to show
    }
    
    func onConsentManagerLoadFailed(_ error: String) {
        // Called if an error occurred during loading
    }
    
    func onConsentWindowShown() {
        // Called when the screen is displayed
    }
    
    func onConsentManagerShownFailed(_ error: String) {
        // Called if there is an error during screen display
    }
    
    func onConsentWindowClosed(_ hasConsent: Bool) {
       // Called when the screen is closed
       // hasConsent - determines whether the user has given consent
    }
    
}
```

2. Associate your event tracking `ViewController` with the Consent Manager SDK.\
   \
   Usually, the `ViewController` that works with Consent Manager is also the class for event tracking, so you can specify `self` as the delegate property.

```swift
ConsentManager.setDelegate(self)
```
