# User location in Cloudflare

> Cloudflare makes user location details available to Cloudflare Workers. Uniform enables you to use these details to configure personalization instructions.

Source: https://docs.uniform.app/docs/integrations/cdn/cloudflare/cloudflare-user-location

Cloudflare makes user location details available to Cloudflare
Workers. Uniform enables you to use these details to configure
personalization instructions.

> **Tip:**
>
> For more information on this topic, see the Cloudflare documentation
> for [incoming request properties](https://developers.cloudflare.com/workers/runtime-apis/request#incomingrequestcfproperties).

## Add quirk definitions

User location details are associated with a specific visitor.
In Uniform, [quirks](https://docs.uniform.app/docs/guides/classification/quirks)
give you a way to associate any information you want with a
visitor. Quirks can then be used as conditions in personalization
instructions.

Before you can configure personalization instructions that use
user location and device details, quirks must be defined.
The Cloudflare connector handles this for you.

1. In Uniform, open your project.
2. Navigate to **Settings > Integrations**.

![](https://docs.uniform.app/images/integrations/cdn/cloudflare/personalization/quirks/cloudflare-integration.png)

1. Click **Cloudflare**.

![](https://docs.uniform.app/images/integrations/cdn/cloudflare/personalization/quirks/add-to-project.png)

1. Click **Add to project**.

![](https://docs.uniform.app/images/integrations/cdn/cloudflare/personalization/quirks/integration-added.png)

> **About this step:**
>
> You will see Cloudflare listed as an installed integration.

1. Navigate to **Optimization > Quirks**.

![](https://docs.uniform.app/images/integrations/cdn/cloudflare/personalization/quirks/quirks.png)

> **About this step:**
>
> You will see a list of quirks that were added by the Cloudflare integration.

## Identify details to include

In the previous section you added quirks to your Uniform project,
but just because a quirk is defined doesn't mean the value will
be populated for your visitors. Values for the quirks defined by
the Cloudflare integration are available from Cloudflare, but you must
add some logic to your Cloudflare Worker to select the values you want
to use.

The EdgeWorker uses the [Cloudflare proxy edge handler](https://sdk.uniform.app/context-edge-cloudflare.createcloudflareproxyedgehandler)
function to run the personalization instructions. When you call
this function, you can specify the user location and device
details you want to make available as quirks.

The following code sample demonstrates how to do this:

```js
import { createEdgeContext } from '@uniformdev/context-edge'
import { createCloudflareProxyEdgeHandler } from '@uniformdev/context-edge-cloudflare'
import { ManifestV2 } from '@uniformdev/context'
import manifest from "./context-manifest.json";
export async function handleRequest(request: Request): Promise<Response> {
  //@ts-ignore
  if (!ORIGIN_URL) {
    console.error('ORIGIN_URL environment is not defined')
    return new Response('Configuration Error', {
      status: 500,
    })
  }
  const handler = createCloudflareProxyEdgeHandler()
  const context = createEdgeContext({
    request,
    manifest: manifest as ManifestV2,
  })
  const { response } = await handler({
    context,
    request,
    quirks: ['city', 'country'],
    //@ts-ignore
    originUrl: new URL(`https://${ORIGIN_URL}`).origin,
  })
  return response
}
```

## Next steps

Now you can create [signals](https://docs.uniform.app/docs/guides/classification/signals) using the quirks you added.

![](https://docs.uniform.app/images/integrations/cdn/cloudflare/personalization/quirks/configure-signal.png)
