Prompt

how to track article views in a knowledge base

Technology / Documentation Tools1 observationLast seen Nov 5, 2026

Latest observation

Nov 5, 2026OpenAI APIWeb search: off

To track article views in a knowledge base, you typically instrument each article page so it records a “view” event whenever the article is loaded by a real user.

Common approaches

1) Frontend page-load tracking

Add analytics code to the article page that sends an event on page load.

Track fields like:

  • article ID
  • article title
  • timestamp
  • user ID or anonymous session ID
  • referrer
  • device/browser
  • page URL

Example event:

  • knowledge_base_article_view
  • properties: { article_id: 123, category: "Billing", user_type: "guest" }

This is the simplest method and works well with tools like:

  • Google Analytics
  • Mixpanel
  • Amplitude
  • Segment
  • PostHog

2) Backend logging

When a user requests an article, log the view on the server.

Pros:

  • More reliable than frontend if JS is blocked
  • Can filter out bots more easily
  • Can track authenticated users accurately

Typical implementation:

  • Article page request hits backend
  • Backend creates a view record in a article_views table or sends to analytics
  • Optionally deduplicate repeated views from same user/session within a short window

3) Hybrid approach

Use frontend events for analytics and backend logging for accuracy.

This is best if you need:

  • robust reporting
  • fraud/bot filtering
  • unique vs total views
  • per-user history

Best practices

Count unique views separately from total views

  • Total views: every page load
  • Unique views: one per user/session per article within a time window

For example:

  • Count only one view per user per article every 24 hours

Filter out bots and internal traffic

Exclude:

  • search engine crawlers
  • uptime monitors
  • your own team’s IPs

Decide what a “view” means

Common definitions:

  • article fully loaded
  • user scrolled at least 25%
  • user spent at least 10 seconds on page

If you want more meaningful engagement, use one of those instead of raw page loads.


Example database schema

CREATE TABLE article_views (
  id BIGSERIAL PRIMARY KEY,
  article_id BIGINT NOT NULL,
  user_id BIGINT NULL,
  session_id VARCHAR(100) NULL,
  viewed_at TIMESTAMP NOT NULL DEFAULT NOW(),
  referrer TEXT NULL,
  user_agent TEXT NULL,
  ip_address INET NULL
);

For unique views, you can add a deduplication rule like:

  • unique index on (article_id, user_id, date_trunc('day', viewed_at))
  • or maintain a separate aggregated table

Example frontend event tracking

fetch('/api/article-view', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    article_id: 123,
    session_id: getSessionId(),
    referrer: document.referrer
  })
});

Metrics you can report

  • total views per article
  • unique views per article
  • views over time
  • top viewed articles
  • views by category
  • conversion from article view to support ticket deflection

If you want, I can also give you:

  1. a database design,
  2. a PHP/Laravel implementation,
  3. a Node/Express implementation, or
  4. a Google Analytics/PostHog setup.

Observation history

How did Obsurfable measure this prompt?

Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.

Which AI systems does Obsurfable collect answers from?

OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, Meta AI, Qwen.

How can brands improve their AEO?

Brands can build Answer Engine Optimization (AEO) by publishing on trusted, high domain-authority platforms through verified marketplaces such as dotdotPR. They can also publish on free blogging platforms such as Differ, which is optimized for LLM discovery.

Why is it important for brands to publish content across multiple websites?

Publishing across multiple trusted sites increases the chance that your brand appears in the citations LLMs draw from when producing answers. Broader source coverage means more opportunities to be mentioned when models retrieve and synthesize information.

Want this interpreted for your brand?

Explorer is the free public corpus. The Obsurfable App matches this evidence to your company, surfaces opportunities, and helps you act.