PHPackages                             silverstripe-labs/googleanalytics - 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. [Logging &amp; Monitoring](/categories/logging)
4. /
5. silverstripe-labs/googleanalytics

ActiveSilverstripe-module[Logging &amp; Monitoring](/categories/logging)

silverstripe-labs/googleanalytics
=================================

The Google Analytics module consists of 2 components that can be employed independently: The Google Logger injects the google analytics javascript snippet into your source code and logs relevant events (as of now only crawler visits) The Analyzer adds the Google Analytics UI to your CMS.

1.1.x-dev(13y ago)3110.2k21[7 issues](https://github.com/silverstripe-labs/silverstripe-googleanalytics/issues)[1 PRs](https://github.com/silverstripe-labs/silverstripe-googleanalytics/pulls)PHP

Since Dec 3Pushed 10y ago16 watchersCompare

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

READMEChangelogDependencies (1)Versions (2)Used By (0)

GOOGLE ANALYTICS
================

[](#google-analytics)

Maintainer Contact
------------------

[](#maintainer-contact)

- Julian Seidenberg &lt;julian ( at) silverstripe (dot) com&gt;

Description
-----------

[](#description)

The Google Analytics module consists of 2 components that can be employed independently: The Google Logger injects the google analytics javascript snippet into your source code and logs relevant events (as of now only crawler visits) The Analyzer adds the GA UI to your CMS

Tentative Roadmap
-----------------

[](#tentative-roadmap)

If you want to help out and develop some of these improvements please fork this project and submit a pull request (see this guide on how to do this: ). I greatly appreciate any help for improving the module.

Quick improvements:

- Show time and date, not just date in graph legend
- Change color of events in the graph of pageview from red to something half-transparent and so that events don't make reading the graph so difficult
- Ability to filter different types of events (at the moment only page "save and publish" events) on and off
- New Metric: Show top incoming search keywords for each page
- New Metric: Show top incoming page links for each page
- New Metric: Show time visitors spend on each page
- Do a Google Search Engine submit when a page is "Saved and Published" so the page is re-indexed quicker.
- Hover state to show details of each event in the pageview graph

Bigger improvements:

- Tools that analyses content and suggests synonyms to use for top search keywords. Using synonyms will improve the search performance as people searching for the synonym terms will be able to find the site.
- Visualize the visitors' navigation paths through the site. I.e. each page has graph of top other pages the visitor goes to from that page.
- Rewrite javascript using entwine for better long-term code maintenance
- Search keyword overlay on content. So search keywords show up in a different color when an admin is browsing the site.
- Add crawler visits as a type of event that can be filtered on/off in the graph
- Overlaying of graphs for comparison of site performs between different time periods / events
- Graph of the amount of time visitors spend on each page. Also show "average time spent on page: 5.54 sec (rank: 2 / 543 pages)".
- Report that identifies the most popular pages
- Summary reports that take in GA stats from a whole subsection of a site (a page and all its children) and displays that as graphs on the parent page

Requirements
------------

[](#requirements)

- SilverStripe 3.1+

DB Adapter Support
------------------

[](#db-adapter-support)

- MySQL
- SQLite
- Postgres
- SQL Server
- Oracle (experimental)

Installation
------------

[](#installation)

1. Follow the usual [module installation process](http://doc.silverstripe.org/framework/en/topics/modules#installation)
2. Activate the logger by adding the following to the end of your mysite/\_config.php: `GoogleLogger::activate('UA-XXXXX-Y');` (hardcode google code, useful in combination with \_ss\_environment.php) or `GoogleLogger::activate('SiteConfig');` (use SiteConfig for setup)
3. Activate the analyzer by adding the following to the end of your mysite/\_config.php: `GoogleAnalyzer::activate('1234567', "my@google.login", "mypassword");` (hardcode credentials, useful in combination with \_ss\_environment.php) or `GoogleAnalyzer::activate('SiteConfig');` (use SiteConfig for setup)
4. If you wish to active the event tracking helper, include `GoogleLogger::set_event_tracking_enabled(true)`
5. Run dev/build (`http://www.mysite.com/dev/build?flush=all`)
6. If you're using SiteConfig populate your siteconfig in the CMS.

Retrieving your credentials from GA
-----------------------------------

[](#retrieving-your-credentials-from-ga)

[![Screenshot showing where to find your credentials in GA](https://camo.githubusercontent.com/5d15c33c9527449308895a440bad93a4d9993a8e70167e3b35545f017da3c86d/68747470733a2f2f7261772e6769746875622e636f6d2f73696c7665727374726970652d6c6162732f73696c7665727374726970652d676f6f676c65616e616c79746963732f6d61737465722f646f63732f68656c702e706e67)](https://camo.githubusercontent.com/5d15c33c9527449308895a440bad93a4d9993a8e70167e3b35545f017da3c86d/68747470733a2f2f7261772e6769746875622e636f6d2f73696c7665727374726970652d6c6162732f73696c7665727374726970652d676f6f676c65616e616c79746963732f6d61737465722f646f63732f68656c702e706e67)

Setup
-----

[](#setup)

### Register additional Crawler:

[](#register-additional-crawler)

```
GoogleLogger::$web_crawlers['Safari'] = 'safari';

```

Registers the additional crawler "Safari" when HTTP\_USER\_AGENT matches the regular expression "safari". Useful for debugging.

### Replace the stock google analytics javascript snippet:

[](#replace-the-stock-google-analytics-javascript-snippet)

The google analytics javascript snippet is designed as a SilverStripe template, so you can easily customize it by just placing your own version of the snippet in themes/yourthemename/templates/GoogleAnalyticsJSSnippet.ss. If you want to hardcode the snippet into your template you can just omit the google code in the logger and no snippet will be injected.

Attention
---------

[](#attention)

Because the logger is by default only attached to the content controller the google analytics javascript snippet gets only injected on pages. Attach it to your custom controller to cover these calls also.

Background information for developers
-------------------------------------

[](#background-information-for-developers)

- [Google Analytics Data API - Data Feed](https://developers.google.com/analytics/devguides/reporting/core/v2/gdataReferenceDataFeed)
- [Google Analytics Data Feed Query Explorer](https://developers.google.com/analytics/devguides/reporting/core/gdataExplorer)

Feedback
--------

[](#feedback)

Please help to improve this module by submitting your feedback/bug reports/support requests/suggestions. Thanks

###  Health Score

33

—

LowBetter than 75% of packages

Maintenance15

Infrequent updates — may be unmaintained

Popularity35

Limited adoption so far

Community28

Small or concentrated contributor base

Maturity49

Maturing project, gaining track record

 Bus Factor3

3 contributors hold 50%+ of commits

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

Unknown

Total

1

Last Release

4915d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/111025?v=4)[Ingo Schommer](/maintainers/chillu)[@chillu](https://github.com/chillu)

![](https://www.gravatar.com/avatar/2ce8ce2ba6180a0964a40d1233608ff7e338751f4bfcb57c10649ce7d8fe2336?d=identicon)[hafriedlander](/maintainers/hafriedlander)

![](https://www.gravatar.com/avatar/eb45d689172f5f825c274b105f278958f220618f06db491ab7ac075a770042bd?d=identicon)[candidasa](/maintainers/candidasa)

![](https://www.gravatar.com/avatar/886e4c1f23d486448445d93db45450f222e77e020ceb9dc45bee1e1d677518ff?d=identicon)[halkyon](/maintainers/halkyon)

---

Top Contributors

[![lingo](https://avatars.githubusercontent.com/u/219531?v=4)](https://github.com/lingo "lingo (13 commits)")[![chillu](https://avatars.githubusercontent.com/u/111025?v=4)](https://github.com/chillu "chillu (8 commits)")[![wilr](https://avatars.githubusercontent.com/u/101629?v=4)](https://github.com/wilr "wilr (8 commits)")[![tractorcow](https://avatars.githubusercontent.com/u/936064?v=4)](https://github.com/tractorcow "tractorcow (3 commits)")[![dhensby](https://avatars.githubusercontent.com/u/563596?v=4)](https://github.com/dhensby "dhensby (2 commits)")[![vikas-srivastava](https://avatars.githubusercontent.com/u/1092931?v=4)](https://github.com/vikas-srivastava "vikas-srivastava (2 commits)")[![geoff-silverstripe](https://avatars.githubusercontent.com/u/318115?v=4)](https://github.com/geoff-silverstripe "geoff-silverstripe (2 commits)")[![tyrannosaurusjames](https://avatars.githubusercontent.com/u/3037783?v=4)](https://github.com/tyrannosaurusjames "tyrannosaurusjames (1 commits)")[![frankmullenger](https://avatars.githubusercontent.com/u/50590?v=4)](https://github.com/frankmullenger "frankmullenger (1 commits)")[![elvinas-liut](https://avatars.githubusercontent.com/u/2812754?v=4)](https://github.com/elvinas-liut "elvinas-liut (1 commits)")[![JarkkoLinnanvirta](https://avatars.githubusercontent.com/u/5046663?v=4)](https://github.com/JarkkoLinnanvirta "JarkkoLinnanvirta (1 commits)")[![Juanitou](https://avatars.githubusercontent.com/u/807463?v=4)](https://github.com/Juanitou "Juanitou (1 commits)")[![lozcalver](https://avatars.githubusercontent.com/u/1655548?v=4)](https://github.com/lozcalver "lozcalver (1 commits)")

---

Tags

googlesilverstripegoogleanalyticssilverstripe-labs

### Embed Badge

![Health badge](/badges/silverstripe-labs-googleanalytics/health.svg)

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

###  Alternatives

[phptek/sentry

Sentry.io integration for SilverStripe. Binds Sentry.io to SilverStripe's error &amp; exception handling subsystem.

15203.5k3](/packages/phptek-sentry)[gluedev/laravel-stackdriver

Enables logging, tracing and error reporting to Google Stackdriver for the Laravel framework

4865.6k](/packages/gluedev-laravel-stackdriver)[markguinn/silverstripe-clockwork

Silverstripe extension integrating the Clockwork Chrome extension

253.5k](/packages/markguinn-silverstripe-clockwork)[silverleague/logviewer

View your SilverStripe logs from inside the CMS

114.6k](/packages/silverleague-logviewer)

PHPackages © 2026

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