---
"@context": https://schema.org
"@type": TechArticle
"@id": https://www.twilio.com/docs/segment/connections/sources/catalog/libraries/website/cloudflare#article
headline: Cloudflare Source
description: Install Segment on your Cloudflare-hosted website to collect analytics data and route it to your destinations through a single integration.
url: https://www.twilio.com/docs/segment/connections/sources/catalog/libraries/website/cloudflare
inLanguage: en
dateModified: 2026-06-25T22:35:15.000Z
author:
  "@type": Organization
  name: Twilio Developer Education Team
publisher:
  "@type": Organization
  name: Twilio
---

# Cloudflare Source

Cloudflare enables customers to mitigate website security attacks and speed up page load times.

Segment makes it simple for Cloudflare customers to integrate analytics, email marketing, advertising, and optimization tools. Rather than installing each tool individually, you install Segment once. Segment collects your data, translates it, and routes it to any tool you want to use.

To install Segment on your Cloudflare-hosted website, create a Cloudflare source and turn on the Segment app for your website. This guide walks through each step.

If you don't have a Segment account, [sign up for free](https://segment.com/signup/).

## Getting started

1. From your workspace's [Sources page](https://app.segment.com/goto-my-workspace/sources/catalog/), click **Add source**.
2. Choose Cloudflare.
3. Give the Source a nickname (usually the domain of your site, for example, segment.com). The nickname is a label used in the Segment interface and in a data warehouse if you choose to use one. *You can edit the name later.*
4. The next page, Overview, surfaces your Segment write key for Cloudflare. Copy this write key.
5. To finish the setup, you'll have to go into your Cloudflare account and enter this Segment write key in their app settings and turn on the "Automatically Track Page Views" option to collect page view data. [Install the Cloudflare app here](https://cloudflare.com/apps/segment/install?source=segment-docs).
6. Return to Segment, click into your Cloudflare Source and you'll be able to add other downstream Destinations where you want to see your website's events.

![The Cloudflare Segment app interface with write key input and typical design preview.](https://docs-resources.prod.twilio.com/59c592020267632738845adb3333f2281da6d18363a87e6cb6f09044c58d8075.png)

As visitors come on to your site, events are now sent to your destinations and automatically loaded into any warehouses you have enabled.

## What data gets sent

If you turned on the `Automatically Track Page Views` option in Cloudflare, [Page](/docs/segment/connections/spec/page/) events should already be flowing into your Segment source. That data is sent using Segment's [Analytics.js](/docs/segment/connections/sources/catalog/libraries/website/javascript) library, which has been loaded onto your site. You can now use it to send custom data to Segment and downstream to other tools.

Read more about [Page calls here](/docs/segment/connections/spec/page/).

## Custom events and properties

In order to track information other than pageviews, you can use [Analytics.js](/docs/segment/connections/sources/catalog/libraries/website/javascript), which is now loaded on your website.

The two most common types of events are [Track](/docs/segment/connections/sources/catalog/libraries/website/javascript/#track) and [Identify](/docs/segment/connections/sources/catalog/libraries/website/javascript/#identify).

The Track API call is how you record any actions your users perform, along with any properties that describe the action. Each action is known as an event. Each event has a name, like **Form Submitted**, and properties, for example a **Form Submitted** event might have properties like `plan` or `accountType`. Calling Track in one of your sources is the first steps to getting started with Segment.

The Identify API call lets you tie a user to their actions and record traits about them. It includes a unique User ID and any optional traits you know about them like their email or name.

Learn more about how to use Analytics.js in Segment's [JavaScript library docs](/docs/segment/connections/sources/catalog/libraries/website/javascript/).
