Tracking User Behavior Without Analytics Tools

Why Avoid Traditional Analytics

Tools like Google Analytics are powerful, but often overkill for static knowledge bases. They introduce performance issues, privacy concerns, and are sometimes blocked by ad blockers. In a knowledge base where UX and speed matter most, you can track basic user behavior using simple, self-contained methods.

What You Can Track Without JavaScript Libraries

  • Page views (approximate, with GitHub Logs or 1px tracking)
  • Search queries via JavaScript
  • Popular articles (via search or manual logging)
  • Click-throughs on internal links

Method 1: Logging Search Queries Locally

In the previous article, we implemented a search.json and a client-side search field. We can extend that JavaScript to log each search query to the browser’s localStorage.

<script>
const searchLog = JSON.parse(localStorage.getItem('kb-search-log')) || [];
document.getElementById('search').addEventListener('input', function () {
  const term = this.value.trim();
  if (term.length > 2 && !searchLog.includes(term)) {
    searchLog.push(term);
    localStorage.setItem('kb-search-log', JSON.stringify(searchLog));
  }
});
</script>

You can add a hidden page like /kb/debug-log.html to view these logs manually in your browser during testing.

Method 2: Use GitHub Page Views from GitHub Insights

If your knowledge base is public, GitHub offers basic traffic analytics:

  • Go to the repository
  • Click on “Insights” → “Traffic”
  • See top pages, referring sites, and unique views

While this data is limited, it’s enough to understand which KB articles are getting attention.

Method 3: Internal Link Click Tracking via JavaScript

You can track user interest by logging clicks on knowledge base article links.

<script>
document.querySelectorAll('.kb-entry a').forEach(link => {
  link.addEventListener('click', () => {
    let clicks = JSON.parse(localStorage.getItem('kb-clicks')) || {};
    const url = link.getAttribute('href');
    clicks[url] = (clicks[url] || 0) + 1;
    localStorage.setItem('kb-clicks', JSON.stringify(clicks));
  });
});
</script>

Again, this is only stored locally — great for testing or single-user evaluation without sending data to third parties.

Method 4: Lightweight Pixel Tracking (Optional)

You can simulate tracking by using a 1x1 pixel image that triggers on each article view. This is useful for server logs but limited on GitHub Pages.

<img src="https://yourdomain.com/tracker.gif?path=/kb/install-theme" width="1" height="1" />

Note: GitHub Pages does not support custom server-side code. But if you migrate to Netlify or Cloudflare Pages, this method can log actual requests to a serverless function or log server.

Method 5: Analyze Search Trends Manually

You can offer users a way to submit feedback about missing articles by inserting a “Didn’t find what you were looking for?” form:

<form name="search-feedback" method="POST" data-netlify="true">
  <input type="hidden" name="page" value="{{ page.url }}" />
  <input type="text" name="query" placeholder="Your search term" required />
  <button type="submit">Submit</button>
</form>

This uses Netlify Forms (or can be redirected to a Google Form) to collect user search feedback.

Semantic Clues from Internal Navigation

You can also improve your knowledge base structure using Liquid to highlight popular or featured articles. For example:

{% raw %}
{% assign featured = site.kb | sort: "weight" | slice: 0,5 %}
<h3>Popular Articles</h3>
<ul>
  {% for article in featured %}
    <li><a href="{{ article.url }}">{{ article.title }}</a></li>
  {% endfor %}
</ul>
{% endraw %}

Manual curation based on observed trends is sometimes more effective than complex analytics.

Why This Approach Works

  • Privacy: No cookies, no tracking scripts, no GDPR/CCPA complexity
  • Speed: No third-party JS means blazing fast performance
  • Control: Track only what you need — nothing more
  • Free: No SaaS subscriptions or API quotas

Case Study: Indie Publisher Documentation

A solo software creator hosted his app's documentation on GitHub Pages with Jekyll. Instead of installing Google Analytics, he used localStorage logging and GitHub’s traffic view. He identified that 75% of users looked for installation and upgrade articles. This insight led him to surface those articles on the homepage — increasing engagement by 28%.

Conclusion

It’s possible to track meaningful user behavior in a static knowledge base without bloated analytics software. By combining clever use of JavaScript, GitHub Insights, and user feedback forms, you can build a feedback loop that improves content quality — while respecting user privacy and keeping your site blazing fast.

Series Wrap-Up

This concludes our seven-part series on building an advanced knowledge base using Jekyll, Mediumish, and GitHub Pages. You now have a fully searchable, categorized, semantically structured knowledge system that respects privacy, costs nothing to host, and is future-proof.

Use what you’ve built as a foundation — whether for product documentation, internal wikis, or public help centers.

Ready to go beyond?

In the next series, we’ll explore how to turn your knowledge base into a monetizable resource with paywalled guides, email capture, and productized support libraries — all while staying on GitHub Pages and Jekyll.