> 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/developer-guide/variables/server-side-variables/public-function-scope/getconsentfromvendor.md).

# getConsentFromVendor

## `getConsentFromVendor` Function

The `getConsentFromVendor` function returns the **current consent state** for a specific vendor **within the context of the currently processed tracking package**.

> ⚠️ This function does **not** reflect the full, persisted user consent. It only reflects the **temporary consent information** associated with the tracking event currently being handled.

***

### Purpose

Use this function to:

* Determine whether a specific vendor (tool) currently has consent in the **active tracking package**
* Dynamically adapt tracking logic based on temporary consent states
* React to consent **changes** in real-time (e.g., allow or block data persistence)

***

### Function Definition

| Property          | Description                     |
| ----------------- | ------------------------------- |
| **Function Name** | `this.getConsentFromVendor`     |
| **Type**          | `function`                      |
| **Available In**  | Server-Side Variables           |
| **Returns**       | `boolean` or `string` (`"ncm"`) |

***

### Return Values

| Value   | Meaning                               |
| ------- | ------------------------------------- |
| `true`  | Consent **granted** for the vendor    |
| `false` | Consent **declined**                  |
| `"ncm"` | Tool is running in **Essential Mode** |

***

### Parameters

| Parameter   | Description                                     | Type     | Required                                      | Example             |
| ----------- | ----------------------------------------------- | -------- | --------------------------------------------- | ------------------- |
| `vendor-id` | Internal ID of the vendor/tool (as used in JTM) | `string` | <i class="fa-square-check">:square-check:</i> | `"googleanalytics"` |

***

### Example Usage

```js
async function() {
  let x = this.getConsentFromVendor("googleanalytics");
  return x;
}
```

This example checks the **current consent status** for the vendor `googleanalytics` and returns `true`, `false`, or `"ncm"` based on the tracking package.

***

### Use Cases

* Execute vendor-specific logic only if consent is granted
* Avoid writing cookies or data when consent is `"false"` or `"ncm"`
* Enrich server-side data conditionally based on vendor consent

***

### Important Notes

* This function references the **current tracking context**, not the user's complete or historical consent status.
* If you need to understand **consent transitions**, refer to `this.package.consent`.
* Vendor IDs must match the **internal names** used in your JENTIS Tag Manager configuration.

***

### Summary

`this.getConsentFromVendor` is a quick and context-aware way to determine if consent is currently given for a specific vendor in the **active tracking event**. It supports dynamic decision-making in server-side variables and ensures that vendor-specific logic only runs under compliant conditions.


---

# 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 dynamically by asking a question.

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

```
GET https://docs.jentis.com/developer-guide/variables/server-side-variables/public-function-scope/getconsentfromvendor.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
