> For the complete documentation index, see [llms.txt](https://docs.jentis.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.jentis.com/app-tracking-setup/google-consent-mode-in-app-sdk.md).

# 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.

You can implement the according variables as custom variables in your configuration, so they fetch the consent based on the app-property-keys. Instead of how the defaults work (which are mapped to website parameter keys).

### 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
