Skip to content

Commit af47554

Browse files
Merge pull request #78 from carbtest/main
resolves issue 77
2 parents b67e6e6 + f2ff35e commit af47554

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

config/cookieconsent.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,21 @@
5555

5656
'policy' => null,
5757

58+
/* Google Analytics configuration
59+
|--------------------------------------------------------------------------
60+
|
61+
| If you use Google Analytics, you can configure the package to automatically
62+
| load the Google Analytics script when the user gives his consent.
63+
|
64+
| The ID parameter is required and represents your Google Analytics ID.
65+
|
66+
| The anonymize parameter is optional and determines whether the user's IP
67+
| address should be anonymized before being sent to Google Analytics.
68+
|
69+
*/
70+
'google_analytics' => [
71+
'id' => env('GOOGLE_ANALYTICS_ID', ""),
72+
'anonymize_ip' => env('GOOGLE_ANALYTICS_ANONYMIZE_IP', true)
73+
],
74+
5875
];

stubs/CookiesServiceProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ protected function registerCookies(): void
2020
// Register all Analytics cookies at once using one single shorthand method:
2121
// Cookies::analytics()
2222
// ->google(
23-
// id: env('GOOGLE_ANALYTICS_ID'),
24-
// anonymizeIp: env('GOOGLE_ANALYTICS_ANONYMIZE_IP'),
23+
// id: config('cookieconsent.google_analytics.id'),
24+
// anonymizeIp: config('cookieconsent.google_analytics.anonymize_ip')
2525
// );
2626

2727
// Register custom cookies under the pre-existing "optional" category:

0 commit comments

Comments
 (0)