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

# IAB Global Privacy Protocol

Using Mobile App Consent, you can enable the IAB Global Privacy Protocol (GPP) for enhanced compliance with US data privacy laws.

IAB GPP helps address the challenges posed by the growing number of different privacy regulations worldwide. Implementing OneTrust with the IAB Global Privacy Protocol Consent empowers publishers to streamline ad tech vendors and advertising content.

You can leverage GPP when configuring for the following frameworks:

California Privacy Rights Act (CPRA)

California Consumer Privacy Act (CCPA)

Virginia Consumer Data Protection Act (CDPA)

Colorado Privacy Act (CPA)

Connecticut Data Privacy Act (CTDPA)

Utah

US National

<br />

> 📘
>
> First, GPP needs to be enabled from geolocation rules within the OneTrust Admin console. For more information on how to configure please visit [Configuring Global Privacy Settings](https://my.onetrust.com/s/article/UUID-0b0fcfe0-1375-f6d2-c731-d8968e180cbf)

### Accessing GPP data

Once a user gives consent, OneTrust will write IAB GPP data and save it to UserDefaults. Your application can access the data by fetching it using following keys.

| GPP Keys               | Data type | Description                                                                                    |
| ---------------------- | --------- | :--------------------------------------------------------------------------------------------- |
| `IABGPP_HDR_Version`   | Integer   | GPP version                                                                                    |
| `IABGPP_HDR_Sections`  | String    | List of Section IDs                                                                            |
| `IABGPP_HDR_GppString` | String    | Full consent string in its encoded form                                                        |
| `IABGPP_GppSID`        | String    | Section ID(s) considered to be in force. Multiple IDs are separated by underscore, e.g. “2\_3” |

### Sample Code Snippet

```swift
// Swift
var GppValue : Any?
guard let savedValue = UserDefaults.standard.value(forKey: "IABGPP_HDR_GppString") else {
	GppValue = ""
	return
}
if savedValue is Int {
	GppValue = String(savedValue as! Int)
} else if savedValue is String {
	GppValue = String(savedValue as! String)
}

// ObjC
id GppValue;
id savedValue = [NSUserDefaults.standardUserDefaults valueForKey:@"IABGPP_HDR_GppString"];
if (savedValue) {
	GppValue = (NSString *)savedValue;
} else {
	GppValue = @"";
}
```

### Section IDs

| GPP Key                     | Data type | Description                                                                                         |
| --------------------------- | --------- | :-------------------------------------------------------------------------------------------------- |
| `IABGPP_[SectionID]_String` | String    | String representation of each section. E.g. IAB TCF EU v2 String will be found at IABGPP\_2\_String |

Each section represents a unique privacy signal, usually a unique jurisdiction. Below are the supported sections, for more information please visit [GPP Signal IDs](https://github.com/InteractiveAdvertisingBureau/Global-Privacy-Platform/blob/main/Sections/Section%20Information.md)

| Section ID | Key                | Description              |
| ---------- | :----------------- | :----------------------- |
| 2          | IABGPP\_2\_String  | EU TCF v2 section        |
| 6          | IABGPP\_6\_String  | USPrivacy String         |
| 7          | IABGPP\_7\_String  | US - national section    |
| 8          | IABGPP\_8\_String  | US - California section  |
| 9          | IABGPP\_9\_String  | US - Virginia section    |
| 10         | IABGPP\_10\_String | US - Colorado section    |
| 11         | IABGPP\_11\_String | US - Utah section        |
| 12         | IABGPP\_12\_String | US - Connecticut section |

### Sample Code Snippet

```swift
// Swift-US National
var GppValue : Any?
guard let savedValue = UserDefaults.standard.value(forKey: "IABGPP_7_String") else {
	GppValue = ""
	return
}
if savedValue is Int {
	GppValue = String(savedValue as! Int)
} else if savedValue is String {
	GppValue = String(savedValue as! String)
}

// ObjC
id GppValue;
id savedValue = [NSUserDefaults.standardUserDefaults valueForKey:@"IABGPP_7_String"];
if (savedValue) {
	GppValue = (NSString *)savedValue;
} else {
	GppValue = @"";
}
```

<br />

### GPP keys for USPrivacy

| GPP Keys                  | Data type | Description                                                                                                                                                                                                |
| ------------------------- | --------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `IABGPP_USP1_Version`     | Integer   | IAB US Privacy String Version number [(see IAB US Privacy v1 specification)](https://github.com/InteractiveAdvertisingBureau/USPrivacy/blob/master/CCPA/US%20Privacy%20String.md#us-privacy-string-format) |
| `IABGPP_USP1_Notice`      | String    | IAB US Privacy notice has been provided                                                                                                                                                                    |
| `IABGPP_USP1_OptOut`      | String    | IAB US Privacy opt out of sale                                                                                                                                                                             |
| `IABGPP_USP1_LSPACovered` | String    | IAB US Privacy publisher is signatory to the LSPA                                                                                                                                                          |

### Sample Code Snippet

```swift
// Swift-USPrivacy
var PrivacyNotice : Any?
guard let savedValue = UserDefaults.standard.value(forKey: "IABGPP_USP1_Notice") else {
	PrivacyNotice = ""
	return
}
if savedValue is Int {
	PrivacyNotice = String(savedValue as! Int)
} else if savedValue is String {
	PrivacyNotice = String(savedValue as! String)
}

// ObjC
id PrivacyNotice;
id savedValue = [NSUserDefaults.standardUserDefaults valueForKey:@"IABGPP_USP1_Notice"];
if (savedValue) {
	PrivacyNotice = (NSString *)savedValue;
} else {
	PrivacyNotice = @"";
}
```