Back to Blog
Dokly

Dokly

Pro API documentation without the $300/mo price tag.

Check it out on Product Hunt →
Analytics
Documentation
Metrics
User Research
Data

Documentation Analytics: Metrics That Actually Matter

Learn which documentation metrics to track, how to measure them, and how to use data to improve your docs. A practical guide to documentation analytics.

Dokly Team
9 min read

You've written great documentation. But is it working? Are developers finding what they need? Are they successful after reading? Documentation analytics helps you answer these questions with data, not guesses.

Why Measure Documentation?#

Without metrics, you're flying blind:

  • Which pages need improvement? Guessing wastes effort
  • Is the new guide helping? No way to know
  • Where are developers struggling? Invisible pain points
  • What content should we prioritize? Unclear ROI

Data transforms documentation from art into science.

The Documentation Metrics Hierarchy#

Not all metrics are equal. Here's how to think about them:

Text
                    ┌─────────────────┐
                    │   Outcomes      │  ← Business impact
                    │  (Hardest to    │     Support tickets, adoption
                    │   measure)      │
                    └────────┬────────┘

                    ┌────────▼────────┐
                    │   Behavior      │  ← User actions
                    │  (Shows intent) │     Clicks, scrolls, copies
                    └────────┬────────┘

                    ┌────────▼────────┐
                    │   Engagement    │  ← Attention
                    │  (Basic signal) │     Page views, time on page
                    └────────┬────────┘

                    ┌────────▼────────┐
                    │    Traffic      │  ← Raw numbers
                    │  (Vanity)       │     Total visits
                    └─────────────────┘

Focus your energy from top to bottom.

Essential Metrics to Track#

1. Search Behavior#

What developers search for reveals what they need:

JavaScript
// Track search queries
analytics.track('docs_search', {
  query: searchQuery,
  results_count: results.length,
  clicked_result: clickedIndex, // null if no click
  time_to_click: timeMs
});

Key metrics:

  • Top searches: What do people look for most?
  • Zero-result searches: What's missing from your docs?
  • Search refinements: When do people rephrase their query?
  • Click position: Do they find answers in top results?

Actionable insights:

FindingAction
"authentication" top searchFeature prominently on homepage
"rate limit" zero resultsAdd rate limiting documentation
Most click 3rd+ resultImprove search ranking or titles
Many refinements for "deploy"Content doesn't match expectations

2. Page Performance#

Not all pages perform equally:

JavaScript
// Track page engagement
analytics.track('docs_page_view', {
  page: window.location.pathname,
  referrer: document.referrer,
  scroll_depth: 0
});
 
// Track scroll depth
window.addEventListener('scroll', throttle(() => {
  const depth = calculateScrollDepth();
  analytics.track('docs_scroll', {
    page: window.location.pathname,
    depth: depth // 25%, 50%, 75%, 100%
  });
}, 1000));

Key metrics:

  • Bounce rate: Leave without engaging
  • Scroll depth: How much content is consumed
  • Time on page: Engagement duration
  • Exit pages: Where do journeys end?

Interpreting the data:

| High bounce + low scroll | Content doesn't match expectation | | High bounce + high scroll | Found answer quickly (good!) | | Low bounce + low scroll | Found links to follow (navigation) | | Low bounce + high scroll | Deep engagement (tutorial/guide) |

3. User Journeys#

How do developers navigate your docs?

JavaScript
// Track navigation paths
analytics.track('docs_navigation', {
  from: previousPage,
  to: currentPage,
  method: 'link' | 'search' | 'sidebar' | 'breadcrumb'
});

Key metrics:

  • Common paths: How do users typically navigate?
  • Dead ends: Pages with high exit rates
  • Loop detection: Do users go back and forth?
  • Time to destination: How long to find key pages?

Example insight:

Text
Common path to "API Reference":
Homepage → Getting Started → API Reference (32%)
Homepage → Concepts → API Reference (28%)
Search → API Reference (25%)
Direct link (15%)

If 25% come from search, make API Reference more discoverable in navigation.

4. Code Interaction#

Track how developers interact with code examples:

JavaScript
// Track code copies
document.querySelectorAll('pre code').forEach(block => {
  block.addEventListener('copy', () => {
    analytics.track('docs_code_copy', {
      page: window.location.pathname,
      language: block.className,
      snippet_id: block.dataset.id
    });
  });
});
 
// Track code tab switches
tabSwitcher.on('switch', (language) => {
  analytics.track('docs_code_language', {
    page: window.location.pathname,
    selected: language,
    available: ['javascript', 'python', 'curl']
  });
});

Key metrics:

  • Copy rate: Which code is most useful?
  • Language preferences: What do your users write?
  • Tab switching: Do users need multiple languages?

5. Feedback Signals#

Direct user feedback complements behavioral data:

JavaScript
// "Was this helpful?" widget
const trackFeedback = (helpful, pageId) => {
  analytics.track('docs_feedback', {
    page: pageId,
    helpful: helpful,
    timestamp: Date.now()
  });
};
 
// Open feedback form
const trackDetailedFeedback = (feedback) => {
  analytics.track('docs_feedback_detailed', {
    page: window.location.pathname,
    rating: feedback.rating,
    category: feedback.category,
    comment: feedback.comment
  });
};

Key metrics:

  • Helpfulness score: % positive ratings per page
  • Feedback volume: Which pages get most feedback?
  • Sentiment analysis: Common themes in comments

Building a Documentation Dashboard#

Essential Dashboard Views#

1. Overview

Text
┌─────────────────────────────────────────────────────────────┐
│ Documentation Health Score: 78/100                    ↑ 3%  │
├─────────────────────────────────────────────────────────────┤
│ Weekly Visitors    │ Avg. Helpfulness  │ Search Success     │
│ 12,450 ↑ 8%       │ 82% ↑ 2%          │ 76% → 0%          │
├─────────────────────────────────────────────────────────────┤
│ Pages Needing Attention                                     │
│ • /docs/auth - Low helpfulness (45%)                       │
│ • /docs/webhooks - High exit rate (78%)                    │
│ • /docs/errors - Zero search results linking here          │
└─────────────────────────────────────────────────────────────┘

2. Search Analytics

Text
┌─────────────────────────────────────────────────────────────┐
│ Top Searches This Week                                      │
│ 1. authentication (234)                                     │
│ 2. rate limits (189)                                        │
│ 3. webhook (156)                                            │
│ 4. pagination (98)                                          │
│ 5. typescript (87)                                          │
├─────────────────────────────────────────────────────────────┤
│ Zero-Result Searches (Content Gaps!)                        │
│ 1. "graphql" (45) - Consider adding GraphQL docs            │
│ 2. "python sdk" (32) - SDK page not indexed properly       │
│ 3. "batch requests" (28) - Need to document batch API      │
└─────────────────────────────────────────────────────────────┘

3. Page Performance

Text
┌─────────────────────────────────────────────────────────────┐
│ Best Performing Pages                                       │
│ Page                  │ Views  │ Helpful │ Scroll  │ Time  │
│ Quick Start           │ 4,521  │ 94%    │ 85%     │ 4:30  │
│ API Reference         │ 3,892  │ 88%    │ 62%     │ 2:15  │
│ Installation          │ 2,456  │ 91%    │ 78%     │ 2:45  │
├─────────────────────────────────────────────────────────────┤
│ Needs Improvement                                           │
│ Page                  │ Views  │ Helpful │ Scroll  │ Time  │
│ Advanced Config       │ 892    │ 45%    │ 32%     │ 0:45  │
│ Troubleshooting       │ 1,204  │ 52%    │ 41%     │ 1:20  │
│ Migration Guide       │ 654    │ 48%    │ 28%     │ 0:55  │
└─────────────────────────────────────────────────────────────┘

Setting Up Analytics#

Option 1: Google Analytics 4

HTML
<!-- Basic GA4 setup -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'G-XXXXX');
</script>

Custom events:

JavaScript
// Track documentation-specific events
gtag('event', 'docs_search', {
  search_term: query,
  results_count: count
});
 
gtag('event', 'docs_feedback', {
  page_path: location.pathname,
  rating: 'helpful' | 'not_helpful'
});

Option 2: Plausible (Privacy-focused)

HTML
<script defer data-domain="docs.yoursite.com"
  src="https://plausible.io/js/script.js"></script>

Custom events:

JavaScript
plausible('CodeCopy', { props: { page: location.pathname }});
plausible('Search', { props: { query: searchQuery }});

Option 3: Custom Solution

TypeScript
// Lightweight custom analytics
class DocsAnalytics {
  private queue: Event[] = [];
  private endpoint = '/api/analytics';
 
  track(event: string, properties: Record<string, any>) {
    this.queue.push({
      event,
      properties,
      timestamp: Date.now(),
      page: window.location.pathname,
      sessionId: this.getSessionId()
    });
 
    this.flush();
  }
 
  private async flush() {
    if (this.queue.length === 0) return;
 
    const events = [...this.queue];
    this.queue = [];
 
    await fetch(this.endpoint, {
      method: 'POST',
      body: JSON.stringify(events),
      headers: { 'Content-Type': 'application/json' }
    });
  }
}

Connecting Docs to Business Outcomes#

The ultimate metrics connect documentation to business value:

Support Ticket Deflection#

SQL
-- Measure support impact
SELECT
  topic,
  tickets_before_docs,
  tickets_after_docs,
  (tickets_before_docs - tickets_after_docs) as deflected,
  deflected / tickets_before_docs * 100 as deflection_rate
FROM support_metrics
WHERE docs_published IS NOT NULL
ORDER BY deflection_rate DESC;
TopicBeforeAfterDeflectedRate
Authentication120/mo45/mo7562%
Rate Limits80/mo25/mo5569%
Webhooks95/mo60/mo3537%

Time to First API Call#

Track how documentation impacts developer success:

JavaScript
// Track developer journey milestones
analytics.track('developer_milestone', {
  milestone: 'first_api_call',
  time_since_signup: timeDelta,
  docs_pages_viewed: pagesViewed,
  last_doc_page: lastDocPage
});

Correlate with documentation engagement:

Text
Developers who read "Quick Start":
  - Avg time to first API call: 23 minutes
  - Success rate: 89%
 
Developers who skipped docs:
  - Avg time to first API call: 2.4 hours
  - Success rate: 54%

Conversion Attribution#

JavaScript
// Track docs influence on signups
if (referrer.includes('/docs/')) {
  analytics.track('signup', {
    docs_influenced: true,
    last_doc_page: referrer,
    pages_viewed: sessionPageCount
  });
}

Using Data to Improve Docs#

The Improvement Loop#

Text
     ┌──────────────────────────────────────────┐
     │                                          │
     ▼                                          │
┌─────────┐    ┌─────────┐    ┌─────────┐    ┌──┴──────┐
│ Measure │ ─▶ │ Analyze │ ─▶ │ Improve │ ─▶ │ Verify  │
└─────────┘    └─────────┘    └─────────┘    └─────────┘

Case Study: Improving a Struggling Page#

Initial metrics (Authentication page):

  • Helpfulness: 45%
  • Scroll depth: 32%
  • Time on page: 45 seconds
  • High exit rate: 68%

Analysis:

  1. Most users leave after first section
  2. Zero-result searches for "OAuth"
  3. Negative feedback mentions "outdated examples"

Improvements made:

  1. Added OAuth section (addressing search gap)
  2. Updated all code examples to latest SDK
  3. Added troubleshooting section
  4. Restructured for scannability

Post-improvement metrics:

  • Helpfulness: 78% (+33%)
  • Scroll depth: 71% (+39%)
  • Time on page: 3:15 (+430%)
  • Exit rate: 34% (-34%)

Prioritization Framework#

Score pages to prioritize improvements:

Text
Priority Score = (Traffic × Impact Potential × Effort Inverse)
 
Where:
- Traffic: Page views / total views
- Impact Potential: 100 - Helpfulness %
- Effort Inverse: 1 / estimated hours to fix
PageTrafficImpactEffortScorePriority
Auth15%550.54.11
Webhooks8%480.331.32
Config3%550.250.43

Privacy Considerations#

Respect user privacy while gathering insights:

JavaScript
// Privacy-respecting analytics
const analytics = {
  track(event, properties) {
    // Don't track if user opted out
    if (localStorage.getItem('analytics_optout')) return;
 
    // Anonymize user data
    const data = {
      event,
      ...properties,
      // No PII - use hashed session ID
      sessionId: this.getAnonymousSessionId(),
      // Generalize location
      country: this.getCountryOnly(),
      // No exact timestamps
      hourOfDay: new Date().getHours()
    };
 
    this.send(data);
  }
};

Best practices:

  • Offer clear opt-out mechanism
  • Don't collect PII
  • Aggregate data for reporting
  • Comply with GDPR/CCPA
  • Document what you collect

Conclusion#

Documentation analytics transforms guesswork into informed decisions. Start with these steps:

  1. Set up basic tracking - Page views, search, feedback
  2. Build a simple dashboard - Top pages, problem pages, searches
  3. Establish baselines - Know where you're starting
  4. Identify one improvement - Pick lowest-performing high-traffic page
  5. Measure the impact - Did changes improve metrics?
  6. Iterate - Continuous improvement cycle

Remember: metrics inform decisions, they don't make them. Combine data with user feedback, support team insights, and your own expertise to create documentation that truly serves developers.


Want built-in documentation analytics? Dokly includes comprehensive analytics dashboards, search tracking, and feedback collection out of the box—so you can focus on improving your docs, not building analytics infrastructure.

Dokly

Dokly

Pro API documentation without the $300/mo price tag.

Check it out on Product Hunt →

Ready to build better docs?

Start creating beautiful documentation with Dokly today.

Get Started Free