Analytics Dashboard

Pubvana tracks page views internally and provides a built-in analytics dashboard — no third-party service required.

TL;DR

Go to Admin → Analytics. View a line chart of daily page views, a table of your top posts by view count, and a table of top referring domains. The date range is adjustable. All data is stored locally — no external analytics service is needed.

Details

How Views Are Tracked

Pubvana records every page view in the page_views table when a visitor opens a single post. Each record stores:

  • entity_typepost or page
  • entity_id — the ID of the viewed post or page
  • referrer_domain — the domain portion of the HTTP Referer header (empty if direct)
  • viewed_at — timestamp of the view

Bot filtering: views from known crawler user agents are not counted. Views from authenticated admin users are not counted by default (configurable in settings).

Analytics Dashboard

The dashboard is at Admin → Analytics and shows three panels:

Daily Views Chart

A line chart (powered by Chart.js) showing the number of page views per day over the selected date range. The date range picker defaults to the last 30 days. Changing the range reloads the chart data via an AJAX call to /admin/analytics/data.

Top Posts

A table listing your most-viewed posts for the selected period, sorted by view count descending. Columns: Post Title (linked), Category, Views.

Top Referrers

A table of the top referring domains sorted by visit count descending. Useful for seeing which external sites are sending you traffic. Direct visits (no referrer) are shown as (direct).

Data Endpoint

The JSON data endpoint at /admin/analytics/data accepts start and end query parameters (YYYY-MM-DD format) and returns:

{
  "chart": [
    { "date": "2025-03-01", "views": 142 },
    { "date": "2025-03-02", "views": 198 }
  ],
  "top_posts": [
    { "title": "My Post", "slug": "my-post", "views": 512 }
  ],
  "top_referrers": [
    { "domain": "google.com", "visits": 310 }
  ]
}

Adding External Analytics

The built-in analytics covers basic traffic data. If you need more advanced tracking (funnels, events, heatmaps), you can add Google Analytics, Plausible, Fathom, or any other tracking snippet by:

  1. Pasting the script tag into an Ad Unit widget placed in a global widget area, or
  2. Adding the script directly to your active theme's layout template file (themes/your-theme/layout.tpl).