> For the complete documentation index, see [llms.txt](https://docs.directoryfa.st/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.directoryfa.st/features/analytics.md).

# Analytics

### Internal Analytics

1. Create your account on [PostHog](https://posthog.com)
2. Get your API key in Settings > Personal API keys
3. Fill the the key in your `.env` file:

{% code title=".env" %}

```bash
NEXT_PUBLIC_POSTHOG_KEY=
```

{% endcode %}

### Stats Showcasing

{% hint style="info" %}
Showcasing your analytic stats allows your customers to be sure that your site has an interesting reach.
{% endhint %}

1. Create a Dashboard on PostHog (Website Metrics is fine to start with)
2. Click on the Share button on the top right corner
3. Check the "Share dashboard publicly" box
4. Copy the "Embed dashboard" code into your .env file:

{% code title=".env" %}

```bash
NEXT_PUBLIC_POSTHOG_IFRAME_URL=
```

{% endcode %}

<figure><img src="/files/hxR3mQF6llgjnsoYORxU" alt=""><figcaption></figcaption></figure>

#### Your visitors have now access to your Analytics Dashboard with the newly added "Stats" link on the Navbar.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.directoryfa.st/features/analytics.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
