PostHog Analytics full report showing pageviews, visitors, sessions, and bounce rate with period-over-period comparison and referrer breakdown

This module is part of the Analyze module ecosystem and included in DXPR CMS.

Your Analytics Data Belongs Next to Your Content, Not in Another Tab

You're editing a page. How many visitors did it get this month? Is traffic growing or declining? Right now you'd switch to PostHog, find the URL, and read a dashboard. With this module, that data lives on the Analyze tab: every entity, every metric, zero context switching.

PostHog Analytics full report showing pageviews, visitors, sessions, and bounce rate with period-over-period comparison

You need Analyze PostHog if

  • You use PostHog for product analytics (cloud or self-hosted) and want traffic data per page inside Drupal
  • Your content team needs pageview, visitor, and session counts without leaving the CMS
  • You want period-over-period comparison to spot trends at a glance
  • You need to break down traffic by referrer, country, device, or browser for targeted content decisions
  • You are building a marketing CMS and need analytics integrated directly into the editorial workflow

What You Get

  • Pageviews, visitors, sessions, and bounce rate per page

    Every content entity shows its PostHog performance in the Analyze tab, with change vs the previous period (e.g., "113 pageviews, up 17.7%") so you see trends, not just numbers.

  • Dimension breakdowns

    Drill into the full report to see where your traffic comes from and how it behaves:

    • Referrer: which sites and campaigns send visitors to this page
    • Country: geographic distribution of your audience
    • Device: desktop vs mobile vs tablet breakdown
    • Browser: Chrome, Firefox, Safari, and others

Top referrers table showing traffic sources with pageview counts, visitor counts, and period-over-period change indicators

  • Flexible filters and date ranges

    Switch between 7, 14, 28, or 90 day windows. Filter by status (new, up, down, lost), country, and text search to zero in on the data that matters.

  • Conversion attribution

    Connect page visits to business outcomes. Define conversion goals (signups, purchases, form submissions) and see which pages drive the most conversions, with revenue tracking and period-over-period comparison.

  • Session replay link

    Jump directly from the Analyze tab to PostHog's session replay, pre-filtered to the current page, and watch real users interact with your content.

  • Drush commands

    Query analytics for any URL, view sitewide reports, check connection status, and clear the cache from the command line.

Getting Started

  1. Install with Composer: composer require drupal/analyze_posthog
  2. Enable the module and the Key module
  3. Create a PostHog personal API key with read access
  4. Store the API key at /admin/config/system/keys and configure your PostHog host and project ID at /admin/config/analyze/posthog
  5. Enable the analyzer per content type at /admin/config/content/analyze-settings

Analyze PostHog configuration page showing setup instructions, PostHog host URL, Project ID, API key selection, date range, and cache settings

Prefer a turnkey demo site?

Spin up DXPR CMS: Drupal pre-configured with DXPR Builder, DXPR Theme, the full Analyze suite including PostHog integration, and security best practices out of the box.

Get DXPR CMS »

Additional requirements

This module requires:

  • Analyze module (>=1.1.0)
  • Key module for secure API key storage
  • A PostHog account (cloud or self-hosted) with a personal API key

FAQ

Does Analyze PostHog work with self-hosted PostHog?

Yes. The module connects to any PostHog instance, cloud or self-hosted. Configure your PostHog host URL and project ID at the module's settings page. Self-hosted installations get the same per-page analytics, dimension breakdowns, and conversion tracking as PostHog Cloud users.

What analytics data appears in the Analyze tab?

Each content entity shows pageviews, unique visitors, sessions, and bounce rate with period-over-period comparison (for example, "113 pageviews, up 17.7%"). The full report adds dimension breakdowns by referrer, country, device, and browser, plus conversion attribution when goals are configured.

Does it cache PostHog data locally?

Yes. Analytics data is cached in Drupal to avoid hitting the PostHog API on every page view. Cache lifetime is configurable and can be cleared via Drush. This keeps the Analyze tab responsive and reduces API usage, especially on sites with high editorial traffic.

Related Modules

  • Analyze - Required parent framework that provides the Analyze tab and plugin system this module extends
  • Key - Required for secure storage of the PostHog API key used by this module
  • Analyze Search Console - Sibling Analyze plugin that adds Google Search Console data to the same Analyze tab
  • Analyze Broken Links - Sibling Analyze plugin for broken link detection in the Analyze tab

Analyze PostHog is part of the Analyze suite included in DXPR CMS, a turnkey marketing CMS for Drupal that combines content analysis, a premium Drupal theme, and a drag-and-drop layout builder. See getting started or explore pricing.

Project information

Releases