PHPackages                             rainlab/googleanalytics-plugin - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. rainlab/googleanalytics-plugin

ActiveOctober-plugin[Utility &amp; Helpers](/categories/utility)

rainlab/googleanalytics-plugin
==============================

Google Analytics integration plugin for October CMS

v2.1.0(2mo ago)2190042[1 issues](https://github.com/rainlab/googleanalytics-plugin/issues)PHPPHP &gt;=8.0

Since May 17Pushed 2mo ago12 watchersCompare

[ Source](https://github.com/rainlab/googleanalytics-plugin)[ Packagist](https://packagist.org/packages/rainlab/googleanalytics-plugin)[ Docs](https://octobercms.com)[ RSS](/packages/rainlab-googleanalytics-plugin/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (2)Dependencies (5)Versions (11)Used By (0)

Google Analytics 4 Integration Plugin
=====================================

[](#google-analytics-4-integration-plugin)

This plugin adds Google Analytics 4 tracking and reporting features to [October CMS](https://octobercms.com). This plugin requires October CMS 3.3 or above.

> **Note**: This plugin does not support Universal Analytics.

> **Important**: this plugin requires the [`bcmath` PHP extension](https://www.php.net/manual/en/book.bc.php). It is required by the Google PHP API.

If you are using October CMS v1 or v2, install v1.3 of the plugin with the following command:

```
composer require rainlab/googleanalytics-plugin "^1.3"
```

Configuring the Google Analytics and Google Cloud accounts
----------------------------------------------------------

[](#configuring-the-google-analytics-and-google-cloud-accounts)

To use the plugin, you will need to have a Google Cloud project with a service account, as well as the Google Analytics Data API enabled for that project. To begin, sign into the [Google Cloud Console](https://console.cloud.google.com/) and create or select your project.

To create a service account in a Google Cloud project:

- Open the [Credentials page](https://console.developers.google.com/project/_/apiui/credential) and select your project.
- Click the **Create credentials** button and select **Service account**.
- Enter a name for the service account, e.g. "October CMS GA". Enter an ID for the service account, e.g. "october-cms-ga".
- Click **Done**. This will create the service account and redirect back to the account list.

To generate and download a private key file for the service account:

- Click the account you just created in the Service Accounts list.
- Click **Keys** in the top menu.
- Click **Add Key** / **Create new key** and select **JSON**. This will download the JSON file. You will need this file later to configure the plugin.

The plugin requires Google Analytics Data API to be enabled for the Google Cloud project. This is needed to fetch the analytics data and display it on the October CMS dashboard. To enable the API:

- Return to the project dashboard page in the Google Cloud Console.
- Click **Enabled APIs &amp; services** in the sidebar.
- Click **Enable APIs and services** in the top menu.
- Search for "Google Analytics Data API".
- Click the found API and enable it.

You can alternatively use [this link](https://console.cloud.google.com/apis/enableflow?apiid=analyticsdata.googleapis.com&credential=client_key), but make sure you're enabling the API for the correct project.

Next, you need to give the service account access to your Google Analytics account:

- In the [Google Cloud dashboard](https://console.cloud.google.com/home/dashboard) select your project, click **APIs &amp; Services** and then **Credentials** in the sidebar.
- In the Service Accounts list, copy email of the service account you created.
- Go to [Google Analytics](https://analytics.google.com/) and select a GA4 property you want to work with.
- In the left-hand menu, click **Admin**.
- In the **Property** column, click on **Property Access Management**.
- Click the **Add +** button and enter the email address of the service account.
- Select the **Viewer** permission for the service account.
- Click the **Add** button to save the changes.

Configuring the plugin
----------------------

[](#configuring-the-plugin)

- Open your October CMS installation Administration Area and go to **Settings** / **Google Analytics**.
- Upload the JSON file you downloaded before to the **Private key** field.
- To find the **Analytics Property ID** - go to your [Google Analytics](https://analytics.google.com/) property's **Admin** page and click **Property Settings**. Copy the **Property ID** value from the page and paste it into the corresponding field on the plugin settings page.
- To find the **Measurement ID** value you first need to create a **Data Stream** on the Admin page of your Google Analytics 4 property. After creating a stream, click it in the stream list and copy the **Measurement ID** value. Paste it into the corresponding field on the plugin settings page.
- Save the settings.

Installing the Google Analytics tracking code
---------------------------------------------

[](#installing-the-google-analytics-tracking-code)

You can use Google Tag Manager to install the tracker code. Below is an explanation how to install the tracker code manually.

- Drop the Google Analytics Tracker component to your CMS layout.
- Add the following code to the layout immediately after the element:

```
{% component 'googleTracker' %}
```

After installing the tracker, you can add Google Analytics dashboard widgets and preview the traffic statistics without leaving October CMS.

Compatibility with Multisite
----------------------------

[](#compatibility-with-multisite)

If every site should have its own analytics settings and widgets, open the **config/multisite.php** file and enable the setting below. Change the value to `true` to enable unique configuration for each site definition.

```
'features' => [
    // ...
    'rainlab_googleanalytics_setting' => false,
]
```

Troubleshooting
---------------

[](#troubleshooting)

### Fix for Windows / XAMPP

[](#fix-for-windows--xampp)

**cURL error 60: SSL certificate problem: unable to get local issuer certificate**

1. Follow this link:  and save it in a file called `cacert.pem`.
2. Open your `php.ini` file insert or edit the following line:

    ```
    curl.cainfo = "[pathtothisfile]\cacert.pem"

    ```
3. Restart Apache

### Popup message simply saying "error" when trying to add the JSON key file.

[](#popup-message-simply-saying-error-when-trying-to-add-the-json-key-file)

Some ad-blockers, such as Chrome's uBlock Origin extension or Firefox's own built-in algorithms, may prevent the uploading of the JSON file key. Disabling these, or whitelisting the October CMS website, may resolve this issue for you.

### License

[](#license)

This plugin is an official extension of the October CMS platform and is free to use if you have a platform license. See [EULA license](https://octobercms.com/eula) for more details.

###  Health Score

56

—

FairBetter than 98% of packages

Maintenance82

Actively maintained with recent releases

Popularity29

Limited adoption so far

Community29

Small or concentrated contributor base

Maturity74

Established project with proven stability

 Bus Factor1

Top contributor holds 59.8% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~354 days

Recently: every ~344 days

Total

9

Last Release

87d ago

Major Versions

v1.3.2 → v2.0.12023-05-02

PHP version history (2 changes)v1.2.3PHP &gt;=7.0

v2.1.0PHP &gt;=8.0

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/106532?v=4)[october](/maintainers/october)[@october](https://github.com/october)

---

Top Contributors

[![daftspunk](https://avatars.githubusercontent.com/u/1392869?v=4)](https://github.com/daftspunk "daftspunk (70 commits)")[![alekseybobkov](https://avatars.githubusercontent.com/u/481606?v=4)](https://github.com/alekseybobkov "alekseybobkov (10 commits)")[![vojtasvoboda](https://avatars.githubusercontent.com/u/374917?v=4)](https://github.com/vojtasvoboda "vojtasvoboda (4 commits)")[![jakobfdev](https://avatars.githubusercontent.com/u/8607110?v=4)](https://github.com/jakobfdev "jakobfdev (3 commits)")[![gergo85](https://avatars.githubusercontent.com/u/2959112?v=4)](https://github.com/gergo85 "gergo85 (3 commits)")[![TheServat](https://avatars.githubusercontent.com/u/12908537?v=4)](https://github.com/TheServat "TheServat (2 commits)")[![octoberapp](https://avatars.githubusercontent.com/u/6543374?v=4)](https://github.com/octoberapp "octoberapp (2 commits)")[![gviabcua](https://avatars.githubusercontent.com/u/24480638?v=4)](https://github.com/gviabcua "gviabcua (1 commits)")[![JoelESvensson](https://avatars.githubusercontent.com/u/6786740?v=4)](https://github.com/JoelESvensson "JoelESvensson (1 commits)")[![kukrik](https://avatars.githubusercontent.com/u/2853034?v=4)](https://github.com/kukrik "kukrik (1 commits)")[![lieszkol](https://avatars.githubusercontent.com/u/16566226?v=4)](https://github.com/lieszkol "lieszkol (1 commits)")[![LukeTowers](https://avatars.githubusercontent.com/u/7253840?v=4)](https://github.com/LukeTowers "LukeTowers (1 commits)")[![mahony0](https://avatars.githubusercontent.com/u/2674488?v=4)](https://github.com/mahony0 "mahony0 (1 commits)")[![matteotrubini](https://avatars.githubusercontent.com/u/7964032?v=4)](https://github.com/matteotrubini "matteotrubini (1 commits)")[![mirorauhala](https://avatars.githubusercontent.com/u/4082806?v=4)](https://github.com/mirorauhala "mirorauhala (1 commits)")[![mohsin](https://avatars.githubusercontent.com/u/1699753?v=4)](https://github.com/mohsin "mohsin (1 commits)")[![Mr118](https://avatars.githubusercontent.com/u/9792509?v=4)](https://github.com/Mr118 "Mr118 (1 commits)")[![NemoD503](https://avatars.githubusercontent.com/u/4633952?v=4)](https://github.com/NemoD503 "NemoD503 (1 commits)")[![niekdemelker](https://avatars.githubusercontent.com/u/17333258?v=4)](https://github.com/niekdemelker "niekdemelker (1 commits)")[![norotaro](https://avatars.githubusercontent.com/u/1774870?v=4)](https://github.com/norotaro "norotaro (1 commits)")

---

Tags

googlecmsanalyticsoctoberrainlab

### Embed Badge

![Health badge](/badges/rainlab-googleanalytics-plugin/health.svg)

```
[![Health](https://phpackages.com/badges/rainlab-googleanalytics-plugin/health.svg)](https://phpackages.com/packages/rainlab-googleanalytics-plugin)
```

###  Alternatives

[spatie/laravel-analytics

A Laravel package to retrieve Google Analytics data.

3.2k5.7M57](/packages/spatie-laravel-analytics)[responsiv/currency-plugin

Currency plugin for October CMS

171.3k1](/packages/responsiv-currency-plugin)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
