diff --git a/Module.php b/Module.php index d697933..2da1c4a 100644 --- a/Module.php +++ b/Module.php @@ -107,6 +107,10 @@ public function getServiceConfig() if (isset($config['allow_linker'])) { $tracker->setAllowLinker($config['allow_linker']); } + + if (true === $config['anonymize_ip']) { + $tracker->setAnonymizeIp(true); + } if (false === $config['enable']) { $tracker->setEnableTracking(false); diff --git a/README.md b/README.md index b23aabd..aaaae2f 100644 --- a/README.md +++ b/README.md @@ -112,7 +112,13 @@ To collect data anonymously, set the flag in the tracker: ```php $ga->setAnonymizeIp(true); ``` - +Or, alternatively, you can set this flag inside the configuration: +```php +'google_analytics' => array( + 'anonymize_ip' => true, +), +``` +More information about what to set in which scenario is available on the [Google Help](https://developers.google.com/analytics/devguides/collection/gajs/methods/gaJSApi_gat#_gat._anonymizeIp) page. ### Tracking multiple domains Google Analytics offers to track statistics from multiple domain names. In order to do so, you can set the canonical domain name and optionally allow diff --git a/config/module.config.php b/config/module.config.php index 0e81bd8..80b58cf 100644 --- a/config/module.config.php +++ b/config/module.config.php @@ -44,5 +44,6 @@ 'id' => '', 'domain_name' => '', 'allow_linker' => false, + 'anonymize_ip' => false, ), -); \ No newline at end of file +);