> For the complete documentation index, see [llms.txt](https://docs.flowappz.com/home/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flowappz.com/home/cookie-consent/getting-started/settings/cookie-consent-storing.md).

# 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/gNmSNCaLrL6iF5up45CW" 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/xoIAj0xSpuYIZHXzNoyE" alt=""><figcaption></figcaption></figure>

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

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

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

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

* Then select a method "**start with Hello World"**

<figure><img src="/files/9LqCwE1lBa6i9WZgsUCl" 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/yYbDYLLFWCGxT4FVQJ3C" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/sVBJgpcaBfvskG5FCI9s" 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/HBsJv6jpzMLjzOgA1fhR" alt=""><figcaption></figcaption></figure>

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

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

* Then, click on **Create Instance**.

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

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

<figure><img src="/files/q8fzKUdAd5xRs4uWMdQn" 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/KoIcsD3XZuXkh2JUMfCt" alt=""><figcaption></figcaption></figure>

* Navigate to the **Bindings** tab and click on **Add Binding**

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

* Then, select the **KV Namespace then click Add binding**.

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

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

<figure><img src="/files/5CYnNJ1XllkxqndPXthe" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/zoGEME55AI6YTs5NJ5bt" 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/SvA6YkZZ93vEa6CCu4im" 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>
