# Cookie Consent Storing

* Navigate to Cloudflare’s official website by clicking on the following link:\
  <https://www.cloudflare.com/>
* If you already have a Cloudflare account, simply log in.
* If you don't have an account, click on **"Start for Free"** as shown in the image below to create a new account.

<figure><img src="/files/1anZcUL8TeQGhZWKVmyS" alt=""><figcaption></figcaption></figure>

* You can easily sign up for a Cloudflare account using your **Google** or **Apple** account for a faster registration process.

<figure><img src="/files/JypftFOGzfFMnPHkqpA9" alt=""><figcaption></figcaption></figure>

* After a successful login, you will be redirected to the Cloudflare dashboard. In the left sidebar menu, find **Compute (Workers)**, click on it to expand the options, and then select **Workers & Pages**.

<figure><img src="/files/n8uaUOsilpnJb6PU2oSN" alt=""><figcaption></figcaption></figure>

* Then, click **"Create"** to add a new worker.

<figure><img src="/files/TGV6HDcRaSSYBSRH0Y0N" alt=""><figcaption></figcaption></figure>

* You will be redirected to the **Create an Application** page. Under the **Workers** tab, click on **Quick Start**, as shown in the image below.

<figure><img src="/files/AWe1yuYCfrAX3Jxfkn6Z" alt=""><figcaption></figcaption></figure>

* Give your worker a name and click **Deploy**. In our example, we have named the worker **cookie-consent-flowappz**.

<figure><img src="/files/b72m9SuC6CtDQg4rX4DC" alt=""><figcaption></figcaption></figure>

* You will be redirected to the **Success** page. Click **Edit Code** to proceed.

<figure><img src="/files/TcS0CtOdeLYsQcRVEEko" alt=""><figcaption></figcaption></figure>

* Then, paste the following code into the code editor and click **Deploy**.

```
export default{async fetch(e,s){const t={"Access-Control-Allow-Origin":"*","Access-Control-Allow-Methods":"GET, HEAD, POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type","Access-Control-Allow-Credentials":"true","Access-Control-Max-Age":"86400"};if("OPTIONS"===e.method)return new Response(null,{headers:t});if("POST"===e.method)try{const o=await e.json(),{cookiePreferences:r,expiryDate:n,browserInfo:a,userIp:c,action:l}=o;if(!(r&&n&&a&&c&&l))return new Response("Invalid payload: Missing required fields.",{status:400,headers:t});const i={action:l,userIp:c,browserInfo:a,cookiePreferences:r,expiryDate:n,timestamp:(new Date).toISOString()};return await s.CONSENTS.put(c,JSON.stringify(i)),new Response("Consent preferences successfully stored.",{status:200,headers:t})}catch(e){return console.error("Failed to store data in KV:",e),new Response("Failed to store consent preferences.",{status:500,headers:t})}return new Response("Method Not Allowed",{status:405,headers:t})}};
```

<figure><img src="/files/F5nbdfkhJJdc5a8jyS6u" alt=""><figcaption></figcaption></figure>

* Then, go back to the **Dashboard**, and in the left-side menu under **Storage and Databases**, click on **KV**.

<figure><img src="/files/NwrTg9CEl4JWaib4FX0z" alt=""><figcaption></figcaption></figure>

* Then, click on **Create**.

<figure><img src="/files/6OfYJNE3Ktfv5oMxeSN5" alt=""><figcaption></figcaption></figure>

* Give a name to the Namespace and click **Add**. In our example, we have used the name **Cookie Consent KV**.

<figure><img src="/files/VB9AOIY7g1ghSgO83bnd" alt=""><figcaption></figcaption></figure>

* Go to **Workers** and **Pages**, then click on the previously created worker. In our example, it is **cookie-consent-flowappz**.

<figure><img src="/files/MhRbBuEmGGJVj01EjRkc" alt=""><figcaption></figcaption></figure>

* Navigate to the **Settings** tab and click on **Variables & Secrets** in the left-side menu.

<figure><img src="/files/NJBaP8B0NEnSzWxBHmZv" alt=""><figcaption></figcaption></figure>

* Under the **Bindings** section, click on **Add**.

<figure><img src="/files/jK47YeQ4zjoO6Txwf0o6" alt=""><figcaption></figcaption></figure>

* Then, select the **KV Namespace**.

<figure><img src="/files/KbsNyw6ru8hgIwZFibaW" alt=""><figcaption></figcaption></figure>

* Enter the variable name as **CONSENTS** and select the KV namespace as **Cookie Consent KV**. After that, click **Deploy**.

<figure><img src="/files/fOiDTysi6OiCuAd47v8F" alt=""><figcaption></figcaption></figure>

* Right-click on the icon shown in the image and copy the URL.

<figure><img src="/files/h7kEJCTlJ2nNRZ6ri1sQ" alt=""><figcaption></figcaption></figure>

* Open your cookie consent app in the designer. Navigate to the **Settings** tab, paste the URL into the **Consent Storing Endpoint** input field, and then click **Save Settings**.

<figure><img src="/files/1xE31JGsCf8hR7nLVCGX" alt=""><figcaption></figcaption></figure>

* To view all stored consents, navigate to **KV** under **Storage and Databases**, then click on **Cookie Consent KV**.

<figure><img src="/files/kpxoelaNimaELc3vhvQ1" alt=""><figcaption></figcaption></figure>

* Then, navigate to the **KV Pairs** section, where you will see all the users' consents.

<figure><img src="/files/cDKXVm6S3y9Ch8vdZH7K" alt=""><figcaption></figcaption></figure>


---

# 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.flowappz.com/home/cookie-consent/getting-started/settings/cookie-consent-storing.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.
