Most DevRel and engineering documentation teams treat developer docs like marketing blogs, measuring success by vanity page views and aggregate bounce rates. At 365Finds, our research indicates this approach is fundamentally flawed. In developer portals, a high bounce rate on an API reference page often signals success—a developer found the cURL command, copied the payload, and left to execute it in their terminal. Conversely, high time-on-page frequently signals friction, ambiguity, or broken sample code.
To truly understand developer behavior, diagnose content gaps, and prove the ROI of documentation on commercial API key registrations, teams running Mintlify need a dual-track telemetry stack: Google Analytics 4 (GA4) for macro-level traffic attribution and search engine acquisition, combined with PostHog for micro-level developer journey analysis, session replays, code snippet copy tracking, and zero-match search discovery.
Here is the complete operational guide to configuring and tuning this architecture in Mintlify's modern docs.json specification.
1. Client-Side Telemetry Setup in docs.json
Mintlify provides first-class native integrations for both GA4 and PostHog. You do not need to install NPM packages or wrap client components; configuration lives directly inside your project's root docs.json.
Minimal Production Configuration
Add your GA4 Measurement ID and PostHog project API key under the top-level integrations key in docs.json:
{
"$schema": "https://mintlify.com/docs.json",
"name": "Acme API Documentation",
"theme": "mint",
"integrations": {
"ga4": {
"measurementId": "G-XXXXXXXXXX"
},
"posthog": {
"apiKey": "phc_your_public_project_api_key_here",
"apiHost": "https://us.i.posthog.com",
"sessionRecording": true
},
"telemetry": {
"enabled": true
}
}
}
Key Parameter Guardrails
- PostHog
apiKey: Must begin withphc_. This is a client-side public token and is completely safe to commit to public or private Git repositories. Never supply your personal PostHog account key or project secret keys. - PostHog
apiHost: If you use PostHog Cloud US, sethttps://us.i.posthog.com; for EU cloud, usehttps://eu.i.posthog.com. If left omitted, Mintlify defaults to routing events through its internal proxy (https://ph.mintlify.com), which helps bypass common client-side ad blockers. sessionRecording: Set totrueby default. If your legal compliance policies prohibit full session playback of developer interactions, set this explicitly tofalse.telemetry.enabled: Keep this astrue(or omit it, astrueis default). Warning: If you explicitly disable telemetry ("enabled": false), Mintlify automatically disables the interactive page rating and reader feedback widgets site-wide.
2. Authorizing PostHog Session Recordings
Enabling sessionRecording: true in docs.json alone will not populate replays if PostHog rejects incoming recording payloads.
- Navigate to your PostHog Project Settings.
- Scroll to the Session Recording section.
- Under Authorized domains for recordings, add your production documentation domain (e.g.,
docs.acme.com) as well as any staging custom subdomains. - If you deploy staging previews via Mintlify deployment links, add those domains to the allowlist or record exclusively on production to conserve recording quotas.
365Finds Operational Rule: Always mask sensitive inputs. In developer documentation, developers often paste test API tokens or internal endpoints into Mintlify's interactive API playground. Ensure PostHog's default canvas and password input masking settings are turned on to prevent capturing sandbox credentials in session replays.
3. Activating the Native Page Feedback Widget
Mintlify features a built-in user feedback loop that lives at the footer of each documentation article. Rather than deploying third-party survey modals that disrupt reading flow, Mintlify embeds lightweight thumbs-up and thumbs-down sentiment buttons and contextual rating inputs.
Configuration Workflow
- Log into the Mintlify Dashboard (
app.mintlify.com). - Go to Settings → General → Feedback.
- Toggle the feedback modules your team plans to monitor:
- Thumbs Rating: Renders binary positive/negative voting at the bottom of every MDX page.
- Contextual Feedback: Prompts the developer to submit a brief comment detailing why the page was unhelpful or what was missing.
- Code Snippet Feedback: Allows readers to flag broken or outdated code blocks directly.
- Triage Pipeline: Received feedback appears under the Mintlify dashboard's Analytics → Feedback tab. DevRel engineers should treat feedback items as GitHub-style triage tickets, categorizing items into
Pending,In Progress,Resolved, orDismissed.
4. Advanced Telemetry: Code Copying and Search Drops
While the default integrations automatically stream page views, search entries, and API console triggers, technical writers and DevRel leads need visibility into two critical developer milestones:
- Code Snippet Copies: Did the reader copy the initialization snippet or SDK cURL request?
- Search Drops: What queries yielded zero results, causing developers to abandon the portal?
Mintlify automatically bundles and executes any standard .js script placed in your repository root. Create an analytics.js file alongside docs.json to monitor code clipboard events and zero-result search interactions.
Injecting Custom Event Tracking (analytics.js)
// analytics.js placed at the root of your Mintlify repository
(function () {
if (typeof window === "undefined") return;
// Track Code Snippet Copy Events
document.addEventListener("click", function (event) {
const copyButton = event.target.closest('button[aria-label*="Copy"], button[data-testid="copy-code-button"]');
if (!copyButton) return;
const codeContainer = copyButton.closest("pre") || copyButton.closest('[class*="code-block"]');
const language = codeContainer ? (codeContainer.getAttribute("data-language") || "unknown") : "unknown";
const currentPath = window.location.pathname;
const payload = {
event: "code_snippet_copied",
path: currentPath,
code_language: language,
timestamp: new Date().toISOString()
};
// Forward to PostHog
if (window.posthog && typeof window.posthog.capture === "function") {
window.posthog.capture("code_snippet_copied", payload);
}
// Forward to Google Analytics 4
if (typeof window.gtag === "function") {
window.gtag("event", "code_snippet_copied", payload);
}
}, true);
})();
Analyzing Search Drops
Zero-result searches represent high-intent developer demands that your documentation fails to satisfy. You can uncover these through two mechanisms:
- Mintlify AI Agent Querying: On paid plans, you can query your documentation data directly via Mintlify's natural language agent in the editor: "What are the top search terms that produced zero page results over the last 30 days?"
- PostHog Search Analytics: When readers submit searches, Mintlify emits search query data. By tracking subsequent page navigations within 10 seconds of a search submission, PostHog isolates sessions where the user immediately bounced or repeated modified queries—a primary signal of search frustration.
5. Connecting Docs Reading to API Key Signups (Attribution Pipeline)
The ultimate metric for commercial developer portals is conversion: how many developers who landed on /docs/quickstart successfully registered for a production API key?
The PostHog Data Warehouse Pipeline
On Mintlify Pro and Enterprise plans, teams can link Mintlify directly as a PostHog Data Warehouse Source:
- In Mintlify, navigate to Settings → Organization → API Keys.
- Generate an Admin API Key (prefixed with
mint_). - Note your Project ID from the same page.
- In PostHog, navigate to Data Pipelines → Sources → + New Source → Mintlify.
- Input the Admin API Key and Project ID.
- PostHog will automatically sync the following data tables:
viewsandvisitors: Path-level consumption, segmented by human users versus AI scrapers.searches: Aggregate query terms and search click-through counts.feedback: Page ratings and qualitative comments with triage status.assistant_conversations: Interactions with the built-in AI assistant, including resolution status.
flowchart LR
A["Developer Lands on Docs"] --> B["Reads Quickstart / Copies cURL"]
B --> C["Client-side PostHog & GA4 Telemetry"]
B --> D["Clicks Outbound CTA: 'Get API Key'"]
D --> E["Console / Dashboard Signup App"]
E --> F["PostHog User Identify (Distinct ID)"]
C --> G["Mintlify Backend Analytics API"]
G --> H["PostHog Data Warehouse Sync (mint_)"]
F & H --> I["Full-Funnel Conversion & Attribution Dashboard"]
Implementing Cross-Domain Attribution
To stitch the anonymous reader on docs.acme.com to the authenticated developer on app.acme.com:
- Ensure both subdomains share the primary root cookie domain (
.acme.com) in PostHog's initialization. - In GA4, ensure cross-domain measurement is enabled between your documentation stream and SaaS application stream.
- Tag outbound console registration buttons in your MDX documents with explicit UTM campaign parameters (e.g.,
https://app.acme.com/signup?utm_source=docs&utm_medium=cta&utm_campaign=quickstart_curl).
Architecture Summary: GA4 vs. PostHog vs. Mintlify Native
| Dimension | Google Analytics 4 (GA4) | PostHog Client & Warehouse | Mintlify Native Dashboard |
|---|---|---|---|
| Primary Value | Macro traffic volume; SEO landing pages; geo breakdown | Granular developer journeys; session replays; copy events | Quick content triage; thumbs up/down scores; AI chat logs |
| Setup Mechanism | integrations.ga4 in docs.json | integrations.posthog + PostHog Data Source | Mintlify Dashboard settings |
| Identifier / Secret | G-XXXXXXXXXX (Public) | phc_... (Client Public); mint_... (Admin Private) | Internal organization token |
| Conversion Funnels | High-level goal tracking; outbound link clicks | End-to-end user identification; docs-to-product funnel | Limited to documentation boundaries |
| AI vs Human Traffic | Blended (requires custom bot filters) | Distinct columns in views and visitors tables | Separated traffic breakdown |
365Finds Recommendation & Verdict
At 365Finds, we firmly advise developer platform teams against relying on either tool in isolation.
- Use GA4 as an executive and marketing reporting tool to verify top-of-funnel reach and search engine indexing health.
- Make PostHog your operational engine for documentation maintenance. Pair client-side session recordings with the server-side PostHog Data Warehouse source. When a core API endpoint experiences an influx of thumbs-down ratings, review PostHog replays on that specific path to watch developers struggle in real time, extract zero-match search terms, and update your code snippets.
Documentation is not marketing collateral; it is an active software interface. Measuring it like software with telemetry and session replays is the fastest way to reduce developer churn.