> [!NOTE]
> **Note:** The setup methods described on this page are legacy configurations and are provided for reference only for existing implementations. If you are setting up a new implementation, refer to the [current setup guide](https://developers.google.com/tag-platform/tag-manager/gateway/setup-guide).

Fill in the following to populate the examples throughout this document.

    Your domain: example.com
    Google tag ID: G-12345
    Tag serving path: /metrics

> [!CAUTION]
> **Caution:** This setup reroutes all traffic with the chosen path. To avoid affecting your website, choose a path that's not already in use.

### Cloudflare Enterprise

> [!NOTE]
> **Note:** For new Cloudflare implementations, use the [current Cloudflare setup guide](https://developers.google.com/tag-platform/tag-manager/gateway/setup-guide#cloudflare) which uses Cloudflare Snippets.

To serve your tag in Google tag gateway for advertisers, you will create a
CNAME entry for a new subdomain, create an [Origin
Rule](https://developers.cloudflare.com/rules/origin-rules/) to forward
requests, and create a [Transform
Rule](https://developers.cloudflare.com/rules/transform/) to include
geolocation information. To complete this setup, you will need to have
a Cloudflare Enterprise plan. If you don't have an Enterprise plan, consider
using the
[Cloudflare in-UI setup](https://developers.google.com/tag-platform/tag-manager/gateway/setup-guide?setup=auto#cloudflare)
instead.

### Create CNAME entry

> [!NOTE]
> **Note:** Tags won't use this CNAME entry; Cloudflare uses it to route requests internally.

Choose a subdomain to reserve for the CNAME entry. Fill in the following to
populate the examples throughout this document. This CNAME is never exposed
outside your Cloudflare configuration, so the name is arbitrary.

    CNAME subdomain: fps

1. In the DNS tab, open the **Records** section.
2. Add a new record with the following configuration:
   - Set **Type** to **CNAME**.
   - Set **Name** to `fps`.
   - Set **Target** to `G-12345.fps.goog`.
3. Save the CNAME record.

### Create the Origin Rule

1. In the Rules tab, open **Origin Rules** and create rule.
2. Enter a rule name, such as `Route measurement`.
3. Match incoming requests based on a **Custom filter expression** and click **Edit expression**.
4. Paste the following expression in the builder: `(http.host eq "example.com" and starts_with(http.request.uri.path, "/metrics"))`
5. Update the **Host Header** to **Rewrite to...** `G-12345.fps.goog`.
6. Update the **DNS Record** to **Override to...** `fps.example.com`.
7. Save the Origin Rule.
8. If there are other Origin Rules, increase the newly created Rule's position so that it will run after any other wildcard paths.
9. In a browser, verify the setup by navigating to: `https://example.com/metrics/healthy`. The page should read `ok`.

### Include geolocation information

1. In the Rules tab, open **Settings**
2. Enable the **Add visitor location headers** option.
3. Wait a few minutes for the rule to propagate. In a browser, verify the set up by navigating to: `https://example.com/metrics/?validate_geo=healthy`. The page should read `ok`.