https://github.com/syntro-opensource/silverstripe-google-analytics
Module to add google analytics to your Page. Uses klaro!.
https://github.com/syntro-opensource/silverstripe-google-analytics
Last synced: 5 months ago
JSON representation
Module to add google analytics to your Page. Uses klaro!.
- Host: GitHub
- URL: https://github.com/syntro-opensource/silverstripe-google-analytics
- Owner: syntro-opensource
- Created: 2022-03-31T13:11:52.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2022-04-02T11:36:13.000Z (about 4 years ago)
- Last Synced: 2026-01-14T13:57:28.115Z (5 months ago)
- Language: PHP
- Size: 25.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Silverstripe Google Analytics
[](https://github.com/syntro-opensource/silverstripe-google-analytics/actions?query=workflow%3A%22%F0%9F%8E%AD+Tests%22+branch%3A%22master%22)
[](https://codecov.io/gh/syntro-opensource/silverstripe-google-analytics)

[](https://github.com/phpstan/phpstan)
[](https://packagist.org/packages/syntro/silverstripe-google-analytics)
[](https://packagist.org/packages/syntro/silverstripe-google-analytics)
Adds Google Analytics to your Website. Uses [`syntro/silverstripe-klaro`](https://github.com/syntro-opensource/silverstripe-klaro)
for consent management.
## Installation
To install this module, run the following command:
```
composer require syntro/silverstripe-google-analytics
```
## Usage
After installing, you have to configure analytics to use your datastream:
```yml
Syntro\SilverstripeGoogleAnalytics\Config:
google_token: G-XXXXXXXX
```
After that, Silverstripe will serve Google Analytics after the user has given
consent.
## Configuration
You can use the following options on `Syntro\SilverstripeGoogleAnalytics\Config`
to influence how the analytics script is loaded:
* `klaro_create_default_purpose`: if true, a new purpose will be created
* `klaro_purposes`: Add the created service to additional purposes. If 'klaro_create_default_purpose' is true, the 'analytics' purpose will be appended.
* `klaro_enabled_by_default`: if true, the generated service will be enabled by default. **WARNING**: enabling this will most likely violate GDPR rules
## Styling klaro!
This Module uses klaro! for consent management via the [`syntro/silverstripe-klaro`](https://github.com/syntro-opensource/silverstripe-klaro)
module. We recommend checking that module out for information on how to style the
consent-window.