Skip to content

Add docs for Grafana's PostHog analytics integration#18132

Merged
bs1180 merged 4 commits into
masterfrom
posthog-code/grafana-integration-docs
Jul 3, 2026
Merged

Add docs for Grafana's PostHog analytics integration#18132
bs1180 merged 4 commits into
masterfrom
posthog-code/grafana-integration-docs

Conversation

@bs1180

@bs1180 bs1180 commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Changes

Grafana 13.1 added PostHog as an analytics destination for its echo service (grafana/grafana#122263, contributed by @rafaeelaudibert). Setting posthog_token (and optionally posthog_host) in the [analytics] section of grafana.ini forwards all of Grafana's frontend usage events — pageviews, UI interactions, experiment views, performance metrics, and frontend errors — to PostHog.

This PR documents the integration:

  • New page contents/docs/libraries/grafana.md (→ /docs/libraries/grafana), structured as reference material per the /docs/libraries convention: intro, prerequisites (Grafana v13.1+), grafana.ini and env-var configuration, verification steps, a table mapping Grafana echo event types to PostHog events, identify behavior, and FAQs.
  • Nav entry in src/navs/index.js under SDKs → Services, in alphabetical order.
  • Grafana logo added to src/constants/logos.ts and wired up via platformLogo frontmatter.

Review feedback addressed

  • Links use app.posthog.com instead of hardcoded us.posthog.com (@rafaeelaudibert)
  • Grafana logo uploaded to Cloudinary and wired up (@rafaeelaudibert)
  • Restructured from tutorial-style to reference-style; removed Objective/"Why is this useful?" boilerplate and the self-hosted PostHog FAQ entry (@gewenyu99)
  • Vale warnings cleared, except the flag on the lowercase grafana in the https://grafana.com/ link URL, which can't be capitalized

Notes

  • New page, so no redirects needed.

🤖 Generated with Claude Code

Grafana 13.1 added PostHog as an analytics destination for its echo service (grafana/grafana#122263). This adds a docs page covering configuration (posthog_token/posthog_host and env-var overrides), the event mapping, and identify behavior, plus a nav entry under SDKs → Services.

Generated-By: PostHog Code
Task-Id: 2ca31431-3b76-4ae4-a4f7-6d077d775286
@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Deploy preview

Status Details Updated (UTC)
🟢 Ready View preview Jul 02, 2026 03:40PM

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Vale prose linter → found 0 errors, 1 warnings, 0 suggestions in your markdown

Full report → Copy the linter results into an LLM to batch-fix issues.

Linter being weird? Update the rules!

contents/docs/libraries/grafana.md — 0 errors, 1 warnings, 0 suggestions
Line Severity Message Rule
6:19 warning Use 'Grafana' instead of 'grafana'. Vale.Terms

Comment thread contents/docs/libraries/grafana.md Outdated
Comment thread contents/docs/libraries/grafana.md Outdated

@rafaeelaudibert rafaeelaudibert left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No platformLogo yet — src/constants/logos.ts has no grafana key, and adding one needs a Grafana SVG uploaded to Cloudinary first. The logo render is conditional, so the page displays fine without it. Happy to wire it up as a follow-up once the asset is uploaded.

Can you make sure this gets added to Cloudinary and appended to the PR?

@github-actions

github-actions Bot commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Bundle report

Total JS (gzip)

6.29 MiB (+0.0 KiB / +0.0%)

Eager graph (static-import closure per entrypoint)

Entrypoint Eager size Budget Modules
app 24.21 MiB (+0.1 KiB / +0.0%) report-only 5516
Largest modules in the app closure
Module Size
css ./node_modules/.pnpm/css-loader@5.2.7_webpack@5.101.3/node_modules/css-loader/dist/cjs.js??ruleSet[1].rules[8].oneOf[1].use[1]!./node_modules/.pnpm/postcss-loader@4.3.0_postcss@8.5.6_webpack@5.101.3/node_modules/postcss-loader/dist/cjs.js??ruleSet[1].rules[8].oneOf[1].use[2]!./src/styles/global.css 708.0 KiB
./src/components/Stickers/Stickers.tsx 696.4 KiB
./.cache/caches/gatsby-plugin-mdx/mdx-scopes-dir/31a094f140f119e73085d847ae81b99b.js + 2 modules 579.3 KiB
./node_modules/.pnpm/@radix-ui+react-icons@1.3.2_react@18.3.1/node_modules/@radix-ui/react-icons/dist/react-icons.esm.js 481.4 KiB
./node_modules/.pnpm/@codemirror+view@6.38.2/node_modules/@codemirror/view/dist/index.js 458.1 KiB
./node_modules/.pnpm/rehype-raw@7.0.0/node_modules/rehype-raw/lib/index.js + 29 modules 395.1 KiB
./node_modules/.pnpm/@posthog+icons@0.36.6_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.cjs.js 364.8 KiB
./node_modules/.pnpm/@posthog+icons@0.36.6_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@posthog/icons/dist/posthog-icons.es.js 354.8 KiB
./src/hooks/useCustomers.tsx + 54 modules 353.9 KiB
./node_modules/.pnpm/react-markdown@8.0.7_@types+react@16.14.66_react@18.3.1/node_modules/react-markdown/lib/react-markdown.js + 88 modules 351.4 KiB
./node_modules/.pnpm/cloudinary-core@2.14.0_lodash@4.17.21/node_modules/cloudinary-core/cloudinary-core.js 281.9 KiB
./src/components/ProductComparisonTable/index.tsx + 116 modules 267.6 KiB
./node_modules/.pnpm/@codesandbox+sandpack-react@2.20.0_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/@codesandbox/sandpack-react/dist/index.mjs 266.6 KiB
./node_modules/.pnpm/d3@7.9.0/node_modules/d3/src/index.js + 208 modules 247.4 KiB
./src/components/Pricing/PricingSlider/Slider.tsx + 87 modules 239.9 KiB

Eager-graph budgets are report-only until a baseline is established. Sizes are gzip of public/**/*.js; eager size is webpack module source bytes.

…, add Grafana logo

- Replace hardcoded us.posthog.com links with app.posthog.com (review feedback)
- Use "project token" terminology and the <ph_project_token> placeholder per Vale linter
- Add grafana key to logos.ts and wire up platformLogo frontmatter

Generated-By: PostHog Code
Task-Id: 2ca31431-3b76-4ae4-a4f7-6d077d775286
@bs1180 bs1180 requested a review from a team July 2, 2026 14:03

@gewenyu99 gewenyu99 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! Thanks for writing this up. The content and writing are generally good, but I have comments on structure.

Thanks for taking this on!

Comment thread contents/docs/libraries/grafana.md Outdated
Comment on lines +6 to +10
## Objective

Forwarding Grafana usage analytics to PostHog using Grafana's built-in PostHog analytics backend.

## Why is this useful?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Objective
Forwarding Grafana usage analytics to PostHog using Grafana's built-in PostHog analytics backend.
## Why is this useful?

We don't need this boiler plate generally.

Comment thread contents/docs/libraries/grafana.md Outdated

To follow this tutorial, you should:

1. Have a [PostHog account](https://us.posthog.com/signup) (Cloud or self-hosted)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. Have a [PostHog account](https://us.posthog.com/signup) (Cloud or self-hosted)
1. Have a [PostHog account](https://app.posthog.com/signup)

Comment thread contents/docs/libraries/grafana.md Outdated
Comment on lines +92 to +94
### Can I use this with a self-hosted PostHog instance?

Yes! Set `posthog_host` to your self-hosted instance URL in the `[analytics]` section of your Grafana configuration.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We generally now keep this information in the self-hosted section of docs and in the hobby deployment repo itself. We do this because we don't offer support on self-deployed instances and it can be confusing when we have it in the general docs and do not offer support.

Comment thread contents/docs/libraries/grafana.md Outdated
1. Have a [PostHog account](https://us.posthog.com/signup) (Cloud or self-hosted)
2. Run a self-managed [Grafana instance](https://grafana.com/docs/grafana/latest/setup-grafana/) on version 13.1 or later

## Step-by-step instructions

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a comment of the general structure of this page. So this sits under https://posthog.com/docs/libraries which generally contain reference material on these libraries.

The structure of these pages are generally consistent and should be something like:

  • Installation
  • Configuring Grafana
  • Verifying the integration
    etc...

If you're looking to write a tutorial, you can also create them for https://posthog.com/tutorials separately, there we'd expect a structure more similar to this. We can also create a more concrete example there.

bs1180 added 2 commits July 2, 2026 16:33
- Drop the Objective / "Why is this useful?" boilerplate; the intro paragraph is now the lede
- Replace tutorial-style "Step-by-step instructions" wrapper with flat reference sections (Configuring Grafana, Verifying the integration)
- Use app.posthog.com signup link without the Cloud/self-hosted qualifier
- Remove self-hosted PostHog FAQ entry; self-hosted guidance lives in the self-hosted docs

Generated-By: PostHog Code
Task-Id: 2ca31431-3b76-4ae4-a4f7-6d077d775286
- Rephrase the intro to avoid the lowercase "logs" product-name flag
- Rename the FAQ heading to "Frequently asked questions" for sentence case

Generated-By: PostHog Code
Task-Id: 2ca31431-3b76-4ae4-a4f7-6d077d775286

@gewenyu99 gewenyu99 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Remember to rerequest review from Rafa since he requested changes

@bs1180 bs1180 dismissed rafaeelaudibert’s stale review July 3, 2026 07:03

Feedback actioned

@bs1180 bs1180 merged commit c95418e into master Jul 3, 2026
19 checks passed
@bs1180 bs1180 deleted the posthog-code/grafana-integration-docs branch July 3, 2026 07:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants