dot CMS
Google Analytics

Fetch Google Analytics 4 data directly into dotCMS templates using the analytics Velocity viewtool — query metrics, dimensions, and date ranges programmatically.

What it does

This plugin provides a $analytics viewtool in Velocity templates that lets you query Google Analytics 4 (GA4) data directly from your dotCMS pages. You can retrieve metrics like active users, page views, sessions, and more, filtered by dimensions like date, page path, device category, and others.

This plugin is for fetching analytics data from Google Analytics into dotCMS. It does not add tracking code to your site. For tracking, use Google Tag Manager or add the GA4 tracking script directly to your templates.

Use Cases

  • Content analytics dashboards inside dotCMS — surface real GA4 performance data (pageviews, sessions, bounce rate) directly in your editorial interface, so your team can make smarter content decisions without leaving the CMS

  • Personalization and content recommendations — power “Most Popular,” “Trending This Week,” or “Readers Also Visited” modules driven by actual traffic data, not manual curation

  • Identify content to retire or improve — spot low-traffic, high-bounce, or stale pages and act on them before they become a liability

  • Automate archive and review workflows — trigger content review states based on real engagement signals, so nothing slips through the cracks

Key capabilities

  • Query GA4 metrics and dimensions directly from Velocity templates

  • Configurable date ranges, filters, and result limits

  • Service account authentication via JSON key file configured in the Apps tool

  • Compatible with all GA4 Data API v1 metrics and dimensions

How to set it up

Requires dotCMS 23.01.10 or higher, a Google Cloud Platform account with the Google Analytics Data API enabled, a service account with JSON credentials, and a GA4 property with Viewer access granted to the service account.

  1. Enable the Google Analytics Data API in your Google Cloud Console project and create a service account with a JSON key file.

  2. Add the service account email as a Viewer in your GA4 property under Admin → Property Access Management.

  3. Download the plugin JAR from the dotCMS/google-analytics GitHub releases page and upload it via System → Dynamic Plugins.

  4. Go to Settings → Apps → Google Analytics, enter an application name, and paste the full contents of your JSON key file.

  5. Use the $analytics viewtool in Velocity templates to create requests, set metrics and dimensions, and query GA4 data.

Read the full setup guide

Explore dotCMS for your organization

image

dotCMS Named a Major Player

In the IDC MarketScape: Worldwide AI-Enabled Headless CMS 2025 Vendor Assessment

image

Explore an interactive tour

See how dotCMS empowers technical and content teams at compliance-led organizations.

image

Schedule a custom demo

Schedule a custom demo with one of our experts and discover the capabilities of dotCMS for your business.