# PostHog

With the PostHog integration, you can attach feature access properties to users and groups on PostHog. This will enable you to query analytics based on feature access filters.

### Get available features from Reflag

In this example, we're using the [@reflag/browser-sdk](/supported-languages/browser-sdk.md):

```javascript
//init
const reflag = new ReflagBrowserSDK.ReflagClient({
  publishableKey: "pub_prod_5eS0G5hX4ZOpwoAw1CKTeP",
  user: {
    id: "u1234",
    name: "Rasmus Makwarth",
  },
});

//get features
const features = reflag.getFeatures();
```

This will return JSON with all available features for the authenticated user:

```json
"features": {
    "export-to-csv": {
        "isEnabled": true,
        "key": "export-to-csv",
        "targetingVersion": 2
    },
    ...
}
```

### Add as property on PostHog

We can forward all features or pick certain features and send access state to PostHog:

<pre class="language-tsx"><code class="lang-tsx"><strong>posthog.identify("u1234", {
</strong>  name: "Rasmus Makwarth",
  features: {
    "export-to-csv": {
      isEnabled: true,
    },
  },
});
</code></pre>

Which will look like this on PostHog:

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

You may want to add the property to the user's group as well.


---

# Agent Instructions: 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.reflag.com/integrations/posthog.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.
