# Google Consent Mode in APP-SDK

The Google Consent Mode variables in JENTIS require a direct connection to the JENTIS DCP vendor configuration. Since app SDKs work only in one direction—sending data from the app SDK to JENTIS—we need to rewrite these variables specifically for the Google connectors. Below, we provide copy-and-paste code examples:

### Google Consent Default (gcd)

```js
async function app_google_consent_default() {

    const config = {
        vendors: {
            ad_storage: ["adwords"],
            analytics_storage: ["google_analytics_4_server-side"],
            ad_user_data: ["adwords"],
            ad_personalization: ["adwords"]
        },
        toolConsents: (function(self) {
            var eventDoc = self.package.documents.filter(docs => docs.documentType === "event");
            return eventDoc[0].system.consent;
        })(this)
    };

    let googleConsentDefault = {
        toolConsents: {},
        consentStatus: {
            ad_storage: "",
            analytics_storage: "",
            ad_user_data: "",
            ad_personalization: ""
        },
        getConsentOfGCT: function(arrConfiguredVendors) {
            if (arrConfiguredVendors.length > 0) {
                var bConsent = "denied";
                for (var vendorsCnt = 0; vendorsCnt < arrConfiguredVendors.length; vendorsCnt++) {
                    var bVendorConsent = this.toolConsents[arrConfiguredVendors[vendorsCnt]];
                    if (bVendorConsent === true) {
                        bConsent = "granted";
                        break;
                    }
                }
                return bConsent;
            }
            return null;

        },
        set: function(config) {
            this.toolConsents = config.toolConsents;

            for (type in this.consentStatus) {
                this.consentStatus[type] = this.getConsentOfGCT(config.vendors[type]);
            }

        },
        prepare: function(config) {
            this.set(config);

            let ad_storage = (this.consentStatus.ad_storage === "granted") ? "r" : "q";
            let analytics_storage = (this.consentStatus.analytics_storage === "granted") ? "r" : "q";
            let ad_user_data = (this.consentStatus.ad_user_data === "granted") ? "r" : "q";
            let ad_personalization = (this.consentStatus.ad_personalization === "granted") ? "r" : "q";

            return `13${ad_storage}3${analytics_storage}P${ad_user_data}2${ad_personalization}5l1`;

        }
    };

    return googleConsentDefault.prepare(config);
}

```

### Google Consent Status (gcs)

```js
async function app_google_consent_status() {

    const config = {
        vendors: {
            ad_storage: ["adwords"],
            analytics_storage: ["google_analytics_4_server-side"]
        },
        toolConsents: (function(self) {
            var eventDoc = self.package.documents.filter(docs => docs.documentType === "event");
            return eventDoc[0].system.consent;
        })(this)
    };

    let googleConsentStatus = {
        googleConsentStatus: "G1",
        toolConsents: {},
        consentStatus: {
            ad_storage: "",
            analytics_storage: ""
        },
        getConsentOfGCT: function(arrConfiguredVendors) {
            if (arrConfiguredVendors.length > 0) {
                var bConsent = "denied";
                for (var vendorsCnt = 0; vendorsCnt < arrConfiguredVendors.length; vendorsCnt++) {
                    var bVendorConsent = this.toolConsents[arrConfiguredVendors[vendorsCnt]];
                    if (bVendorConsent === true) {
                        bConsent = "granted";
                        break;
                    }
                }
                return bConsent;
            }
            return null;

        },
        set: function(config) {
            this.toolConsents = config.toolConsents;

            for (type in this.consentStatus) {
                this.consentStatus[type] = this.getConsentOfGCT(config.vendors[type]);
            }

        },
        prepare: function(config) {
            this.set(config);

            for (type in this.consentStatus) {
                this.googleConsentStatus += (this.consentStatus[type] === "granted") ? "1" : "0";
            }

            return this.googleConsentStatus;

        }
    };

    return googleConsentStatus.prepare(config);

}
```

### Non Personalized Ads (npa)

```js
async function non_personalized_ads() {

    const config = {
        vendors: {
            ad_personalization: ["adwords"]
        },
        toolConsents: (function(self) {
            var eventDoc = self.package.documents.filter(docs => docs.documentType === "event");
            return eventDoc[0].system.consent;
        })(this)
    };

    let nonPersonalizedAvertisement = {
        toolConsents: {},
        consentStatus: {
            ad_personalization: ""
        },
        getConsentOfGCT: function(arrConfiguredVendors) {
            if (arrConfiguredVendors.length > 0) {
                var bConsent = "denied";
                for (var vendorsCnt = 0; vendorsCnt < arrConfiguredVendors.length; vendorsCnt++) {
                    var bVendorConsent = this.toolConsents[arrConfiguredVendors[vendorsCnt]];
                    if (bVendorConsent === true) {
                        bConsent = "granted";
                        break;
                    }
                }
                return bConsent;
            }
            return null;

        },
        set: function(config) {
            this.toolConsents = config.toolConsents;
            for (type in this.consentStatus) {
                this.consentStatus[type] = this.getConsentOfGCT(config.vendors[type]);
            }
        },
        prepare: function(config) {

            this.set(config);

            return (this.consentStatus.ad_personalization === "granted") ? "0" : "1";
        }
    };

    return nonPersonalizedAvertisement.prepare(config);
}
```

### Digital Market Act Parameter (dma\_cps)

```js
async function digital_market_act_parameter() {

    const config = {
        vendors: {
            ad_user_data: ["adwords"]
        },
        toolConsents: (function(self) {
            var eventDoc = self.package.documents.filter(docs => docs.documentType === "event");
            return eventDoc[0].system.consent;
        })(this)
    };

    let digitalMarketActServices = {
        toolConsents: {},
        consentStatus: {
            ad_user_data: ""
        },
        getConsentOfGCT: function(arrConfiguredVendors) {
            if (arrConfiguredVendors.length > 0) {
                var bConsent = "denied";
                for (var vendorsCnt = 0; vendorsCnt < arrConfiguredVendors.length; vendorsCnt++) {
                    var bVendorConsent = this.toolConsents[arrConfiguredVendors[vendorsCnt]];
                    if (bVendorConsent === true) {
                        bConsent = "granted";
                        break;
                    }
                }
                return bConsent;
            }
            return null;

        },
        set: function(config) {
            this.toolConsents = config.toolConsents;
            for (type in this.consentStatus) {
                this.consentStatus[type] = this.getConsentOfGCT(config.vendors[type]);
            }
        },
        prepare: function(config) {

            this.set(config);

            return (this.consentStatus.ad_user_data === "granted") ? "syphamo" : "-";
        }
    };

    return digitalMarketActServices.prepare(config);
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.jentis.com/app-tracking-setup/google-consent-mode-in-app-sdk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
