

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# consent\_gpp\_v1\_decode 函數
<a name="consent_gpp_v1_decode"></a>

`consent_gpp_v1_decode` 函數用於解碼全球隱私權平台 (GPP) v1 同意資料。它以編碼的同意字串做為輸入，並傳回解碼的同意資料，其中包括使用者隱私權偏好設定和同意選擇的相關資訊。此函數在處理包含 GPP v1 同意資訊的資料時非常有用，因為它可讓您以結構化格式存取和分析同意資料。

## 語法
<a name="consent_gpp_v1_decode-syntax"></a>

```
consent_gpp_v1_decode(gpp_string)
```

## 引數
<a name="consent_gpp_v1_decode-arguments"></a>

 *gpp\_string*   
編碼的 GPP v1 同意字串。

## 傳回值
<a name="consent_gpp_v1_decode-returm-type"></a>

傳回的字典包含下列鍵值對：
+ `version`：使用的 GPP 規格版本 （目前為 1)。
+ `cmpId`：編碼同意字串的同意管理平台 (CMP) ID。
+ `cmpVersion`：編碼同意字串的 CMP 版本。
+ `consentScreen`：使用者提供同意的 CMP UI 中的畫面 ID。
+ `consentLanguage`：同意資訊的語言代碼。
+ `vendorListVersion`：使用的廠商清單版本。
+ `publisherCountryCode`：發佈者的國家/地區代碼。
+ `purposeConsent`：整數清單，代表使用者同意的目的。
+ `purposeLegitimateInterest`：已透明地傳達使用者合法利益的目的 IDs 清單。
+ `specialFeatureOptIns`：整數清單，代表使用者已選擇加入的特殊功能。
+ `vendorConsent`：使用者已同意的供應商 IDs清單。
+ `vendorLegitimateInterest`：已透明地傳達使用者合法利益的供應商 IDs 清單。

## 範例
<a name="consent_gpp_v1_decode-example"></a>

下列範例採用單一引數，也就是編碼的同意字串。它會傳回包含解碼同意資料的字典，包括使用者隱私權偏好設定、同意選擇和其他中繼資料的相關資訊。

```
SELECT * FROM consent_gpp_v1_decode('ABCDEFGHIJK');
```

傳回之同意資料的基本結構包括同意字串版本、CMP （同意管理平台） 詳細資訊、使用者對不同用途和供應商的同意和合法利益選擇，以及其他中繼資料的相關資訊。

```
{
    "version": 1,
    "cmpId": 12,
    "cmpVersion": 34,
    "consentScreen": 5,
    "consentLanguage": "en",
    "vendorListVersion": 89,
    "publisherCountryCode": "US",
    "purposeConsent": [1],
    "purposeLegitimateInterests": [1],
    "specialFeatureOptins": [1],
    "vendorConsent": [1],
    "vendorLegitimateInterests": [1]}
}
```