> ## 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.

# Replit

> Add Trfyx analytics to a Replit application.

# Add Trfyx to your Replit project

Use Replit Agent to install Trfyx in the shared application shell, then verify the integration on the deployed site. The script URL should be included explicitly in the generated code: `https://app.trfyx.com/script.js`.

## 1. Prepare the tracking snippet

Use your Trfyx Website ID and the domain you want to measure:

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

<Warning>
  Replace `YOUR_TRFYX_PROJECT_ID` with your Trfyx Website ID and `yourdomain.com` with the domain you want to track. Keep the script URL exactly as shown.
</Warning>

## 2. Ask Replit Agent to add tracking

Open Replit Agent and use a prompt similar to this:

```text theme={null}
Integrate Trfyx analytics into my web application.

Use https://app.trfyx.com/script.js as the tracking script URL.
Use data-website-id="YOUR_TRFYX_PROJECT_ID" and data-domain="yourdomain.com", replacing the placeholders with the real Trfyx Website ID and domain I provide.

Detect the framework and choose the correct global integration point:
- For HTML apps, use the shared <head>.
- For React or Next.js apps, use the root layout or entry point.
- For server-rendered applications, use the shared base template.

Load the tracker once across the application. Do not add duplicate scripts to individual pages or components. Tell me which files you changed and how to test the integration.
```

The right file depends on the framework Replit generated. The important part is that the tracker is added to the shared application shell, not repeatedly to individual pages or components.

## 3. Run, deploy, and verify

1. Use Replit's Run action to check for errors.
2. Deploy the application through your normal Replit deployment flow.
3. Open the public URL and visit several pages or routes.
4. Open browser Developer Tools and confirm the Trfyx script and tracking requests load.
5. Check [app.trfyx.com](https://app.trfyx.com/) for incoming activity.

## Troubleshooting

If tracking is missing, confirm the generated HTML contains the correct Trfyx script URL, Website ID, and domain. Check the Network tab for blocked requests, review CSP and consent settings, and search for duplicate installations. Re-check the shared layout if you regenerate or restructure the application.


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