Skip to main content
Enterprise Edition FeatureThis feature requires an Enterprise plan. View plans or contact sales to learn more.
Self-hosted Onyx Enterprise deployments can load a custom analytics script, such as PostHog or Google Analytics, into the Onyx web app.
1

Set the CUSTOM_ANALYTICS_SECRET_KEY environment variable

Set CUSTOM_ANALYTICS_SECRET_KEY on the API server to a random string. Save the value, you need it in step 3.Re-deploy Onyx. The Custom Analytics page appears in the Admin Panel only when this variable is set.
2

Open Custom Analytics in the Admin Panel

Open Admin Panel > Custom Analytics. If the page says Custom Analytics is not enabled, the environment variable is not set.
3

Enter the JavaScript snippet from your analytics provider

Paste the snippet that your provider asks you to put in the <head> of a web page. Enter the secret key from step 1 and save.
Remove the surrounding <script> tags before you paste the snippet.
For reference, see PostHog’s documentation on how to install its snippet.