> ## Documentation Index
> Fetch the complete documentation index at: https://help.trfyx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Set up Trfyx Managed Proxy

> Route Trfyx analytics through a subdomain you control without running proxy code.

Managed Proxy routes Trfyx analytics through a subdomain you control without requiring you to run proxy code.

Trfyx handles the proxy routing and SSL. You only need to choose a subdomain, add the DNS record shown in your Trfyx settings, and update your tracking script.

<Note>
  Managed Proxy is the recommended option for most production websites. Use a self-hosted proxy only when you already need to control the proxy layer yourself.
</Note>

## Why use a proxy?

Browsers, extensions, corporate networks, and ad blockers can block requests to known analytics domains. A first-party subdomain makes your collection path look like part of your own website.

<CodeGroup>
  ```text Without a proxy theme={"dark"}
  yourdomain.com → app.trfyx.com
  ```

  ```text With Managed Proxy theme={"dark"}
  yourdomain.com → analytics.yourdomain.com → Trfyx
  ```
</CodeGroup>

Your analytics still go to Trfyx. The proxy only changes how the browser reaches the collection service.

## Set up Managed Proxy

<Steps>
  <Step title="Enable Managed Proxy">
    In Trfyx, open the website you want to configure and go to its proxy or tracking settings. Enter a dedicated subdomain that belongs to your website, such as `a.yourdomain.com` or `cdn.yourdomain.com`.

    Prefer a short, neutral hostname. Avoid obvious names such as `analytics`, `tracking`, or `metrics` if your goal is to reduce filtering by simplistic blocklists.

    Enable Managed Proxy. Trfyx will show the DNS record required for your chosen hostname.
  </Step>

  <Step title="Add the DNS record">
    Open your DNS provider and create the record shown in Trfyx.

    For a typical setup, this is a CNAME:

    | Field | Value |
    | - | - |
    | Type | `CNAME` |
    | Name / Host | Your chosen subdomain, for example `a` |
    | Target / Value | The target shown in Trfyx Managed Proxy settings |

    <Warning>
      Do not guess the target value. Copy the exact target displayed in your Trfyx dashboard because it can change between environments or deployments.
    </Warning>

    If Trfyx asks you to add a TXT verification record, add that record as well. Once the hostname is verified and the proxy becomes active, you can remove a temporary verification record if Trfyx explicitly says it is no longer required.

    DNS changes can take a few minutes to propagate.
  </Step>

  <Step title="Update your tracking script">
    Change the tracker so both the script and event requests use your managed proxy hostname.

    ```html index.html theme={"dark"}
    <script
      defer
      data-website-id="YOUR_TRFYX_PROJECT_ID"
      data-domain="yourdomain.com"
      data-api-url="https://a.yourdomain.com/api/events"
      src="https://a.yourdomain.com/script.js"
    ></script>
    ```

    The important details are:

    * `data-domain` remains your **real website domain**.
    * `src` points to the script on your proxy hostname.
    * `data-api-url` points to the event endpoint on the same proxy hostname.
    * Use the same proxy hostname for both URLs.

    <Warning>
      Do not make `data-api-url` relative when using Managed Proxy. A value such as `/api/events` resolves against the page's hostname, not the proxy hostname. Use the complete `https://...` URL instead.
    </Warning>
  </Step>

  <Step title="Test locally (optional)">
    If you need to test tracking locally, enable localhost tracking in your tracker configuration and keep the event URL pointed at the live managed proxy.

    ```html index.html theme={"dark"}
    <script
      defer
      data-website-id="YOUR_TRFYX_PROJECT_ID"
      data-domain="yourdomain.com"
      data-allow-localhost="true"
      data-api-url="https://a.yourdomain.com/api/events"
      src="https://a.yourdomain.com/script.js"
    ></script>
    ```
  </Step>

  <Step title="Verify installation">
    1. Visit your real website. Do not use the proxy hostname as the page you browse.
    2. Open **Developer Tools → Network** and reload the page. Confirm `script.js` is loaded from your proxy hostname.
    3. Trigger a pageview or tracked event and confirm the request goes to your proxy hostname's `/api/events` endpoint.
    4. Confirm the new visit or event appears in your Trfyx dashboard.
  </Step>
</Steps>

## Troubleshooting

### Proxy status stays pending

* Confirm the CNAME exactly matches the record shown in Trfyx.
* Make sure you created a DNS record, not a URL redirect or forwarding rule.
* Check that the DNS record is in the correct zone for your domain.
* Wait for DNS propagation, then refresh the proxy status.

### Proxy status shows an error

Re-check the record type, hostname, target, and any TXT verification record shown in Trfyx. Do not add additional DNS records unless Trfyx asks for them.

### Events are still sent to Trfyx directly

Inspect the tracker in the deployed page source and Network panel. Both `src` and `data-api-url` should use your managed proxy hostname.

### All visitors have the same location

This usually means the original visitor IP is not reaching Trfyx correctly. Managed Proxy is designed to handle visitor IP forwarding automatically. If the problem persists, verify that the request is actually going through the Managed Proxy and contact Trfyx support with the affected hostname.

### Analytics are still blocked

* Use a neutral proxy hostname.
* Confirm the deployed script does not reference `app.trfyx.com`.
* Check your Content Security Policy and allow the proxy hostname in `script-src` and `connect-src` where required.
* Test in a clean browser session without extensions to separate implementation problems from browser filtering.

## Remove Managed Proxy

<Steps>
  <Step title="Disable Managed Proxy">
    Disable or remove Managed Proxy in your Trfyx website settings.
  </Step>

  <Step title="Remove DNS records">
    Remove the DNS records created for the proxy.
  </Step>

  <Step title="Switch back to standard tracking">
    Change the tracker back to the standard Trfyx script:

    ```html index.html theme={"dark"}
    <script
      defer
      data-website-id="YOUR_TRFYX_PROJECT_ID"
      data-domain="yourdomain.com"
      src="https://app.trfyx.com/script.js"
    ></script>
    ```
  </Step>
</Steps>

Your existing analytics data is not removed just because you stop using the proxy.

## Next steps

<CardGroup cols={2}>
  <Card title="Goals" icon="bullseye" href="/goals">
    Define the actions that matter to your business.
  </Card>

  <Card title="Funnels" icon="filter" href="/funnels">
    Understand where users convert or drop off.
  </Card>

  <Card title="Proxy setup" icon="signs-post" href="/proxy-guide">
    Compare Managed Proxy with self-hosted options.
  </Card>

  <Card title="Troubleshooting" icon="life-ring" href="/troubleshooting">
    Diagnose missing or unexpected data.
  </Card>
</CardGroup>


## Related topics

- [Quickstart](/quickstart.md)
- [Proxy Trfyx through your domain](/proxy-guide.md)
- [Proxy Trfyx with Laravel](/laravel-proxy.md)
- [Proxy Trfyx with Astro](/astro-proxy.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.