Skip to content

Commit c930c23

Browse files
authored
Merge pull request #97 from iMattPro/agreement
Add Google Analytics privacy information
2 parents f1d39a3 + c731359 commit c930c23

26 files changed

+1295
-11
lines changed

event/listener.php

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,9 +60,10 @@ public function __construct(config $config, language $language, template $templa
6060
public static function getSubscribedEvents()
6161
{
6262
return [
63+
'core.page_header' => 'load_google_analytics',
6364
'core.acp_board_config_edit_add' => 'add_googleanalytics_configs',
64-
'core.page_header' => 'load_google_analytics',
65-
'core.validate_config_variable' => 'validate_googleanalytics_id',
65+
'core.validate_config_variable' => 'validate_googleanalytics_id',
66+
'core.page_footer_after' => 'append_agreement',
6667
];
6768
}
6869

@@ -171,4 +172,24 @@ public function validate_googleanalytics_id($event)
171172
// Update error event data
172173
$event['error'] = $error;
173174
}
175+
176+
/**
177+
* Append additional agreement details to the privacy agreement.
178+
*
179+
* @return void
180+
*/
181+
public function append_agreement()
182+
{
183+
if (!$this->config['googleanalytics_id']
184+
|| (strpos($this->user->page['page_name'], 'ucp') !== 0)
185+
|| !$this->template->retrieve_var('S_AGREEMENT')
186+
|| ($this->template->retrieve_var('AGREEMENT_TITLE') !== $this->language->lang('PRIVACY')))
187+
{
188+
return;
189+
}
190+
191+
$this->language->add_lang('googleanalytics_ucp', 'phpbb/googleanalytics');
192+
193+
$this->template->append_var('AGREEMENT_TEXT', $this->language->lang('PHPBB_ANALYTICS_PRIVACY_POLICY', $this->config['sitename']));
194+
}
174195
}
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
/**
3+
*
4+
* Google Analytics extension for the phpBB Forum Software package.
5+
*
6+
* @copyright (c) 2025 phpBB Limited <https://www.phpbb.com>
7+
* @license GNU General Public License, version 2 (GPL-2.0)
8+
*
9+
*/
10+
11+
/**
12+
* DO NOT CHANGE
13+
*/
14+
if (!defined('IN_PHPBB'))
15+
{
16+
exit;
17+
}
18+
19+
if (empty($lang) || !is_array($lang))
20+
{
21+
$lang = [];
22+
}
23+
24+
// DEVELOPERS PLEASE NOTE
25+
//
26+
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
27+
//
28+
// Placeholders can now contain order information, e.g. instead of
29+
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
30+
// translators to re-order the output of data while ensuring it remains correct
31+
//
32+
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
33+
// equally where a string contains only two placeholders which are used to wrap text
34+
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
35+
//
36+
// Some characters you may want to copy&paste:
37+
// ’ » “ ” …
38+
//
39+
40+
$lang = array_merge($lang, [
41+
'PHPBB_ANALYTICS_PRIVACY_POLICY' => '
42+
<br><br>
43+
<h3>Analytics</h3>
44+
“%1$s” may use Google Analytics, a web analytics service provided by Google LLC (“Google”), to help us understand how visitors use the site. Google Analytics uses cookies and similar technologies to collect information about your interactions with the site, including the pages you visit, the time spent on each page, and general usage patterns.
45+
<br><br>
46+
The information generated by these cookies about your use of “%1$s” (including your IP address) is transmitted to and stored by Google on servers in the United States or other locations. Google uses this information to evaluate your use of the site, compile reports on website activity for us, and provide other services relating to website activity and internet usage.
47+
<br><br>
48+
Google may also transfer this information to third parties where required to do so by law, or where such third parties process the information on Google’s behalf. To learn more about how Google collects and processes data, please see Google’s Privacy Policy at: <a href="https://policies.google.com/privacy" target="_blank">https://policies.google.com/privacy</a>.
49+
<br><br>
50+
You can opt out of Google Analytics by installing the Google Analytics opt-out browser add-on, available at: <a href="https://tools.google.com/dlpage/gaoptout" target="_blank">https://tools.google.com/dlpage/gaoptout</a>.
51+
',
52+
]);
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
/**
3+
*
4+
* Google Analytics extension for the phpBB Forum Software package.
5+
*
6+
* @copyright (c) 2025 phpBB Limited <https://www.phpbb.com>
7+
* @license GNU General Public License, version 2 (GPL-2.0)
8+
*
9+
*/
10+
11+
/**
12+
* DO NOT CHANGE
13+
*/
14+
if (!defined('IN_PHPBB'))
15+
{
16+
exit;
17+
}
18+
19+
if (empty($lang) || !is_array($lang))
20+
{
21+
$lang = [];
22+
}
23+
24+
// DEVELOPERS PLEASE NOTE
25+
//
26+
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
27+
//
28+
// Placeholders can now contain order information, e.g. instead of
29+
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
30+
// translators to re-order the output of data while ensuring it remains correct
31+
//
32+
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
33+
// equally where a string contains only two placeholders which are used to wrap text
34+
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
35+
//
36+
// Some characters you may want to copy&paste:
37+
// ’ » “ ” …
38+
//
39+
40+
$lang = array_merge($lang, [
41+
'PHPBB_ANALYTICS_PRIVACY_POLICY' => '
42+
<br><br>
43+
<h3>Analytics</h3>
44+
“%1$s” may use Google Analytics, a web analytics service provided by Google LLC (“Google”), to help us understand how visitors use the site. Google Analytics uses cookies and similar technologies to collect information about your interactions with the site, including the pages you visit, the time spent on each page, and general usage patterns.
45+
<br><br>
46+
The information generated by these cookies about your use of “%1$s” (including your IP address) is transmitted to and stored by Google on servers in the United States or other locations. Google uses this information to evaluate your use of the site, compile reports on website activity for us, and provide other services relating to website activity and internet usage.
47+
<br><br>
48+
Google may also transfer this information to third parties where required to do so by law, or where such third parties process the information on Google’s behalf. To learn more about how Google collects and processes data, please see Google’s Privacy Policy at: <a href="https://policies.google.com/privacy" target="_blank">https://policies.google.com/privacy</a>.
49+
<br><br>
50+
You can opt out of Google Analytics by installing the Google Analytics opt-out browser add-on, available at: <a href="https://tools.google.com/dlpage/gaoptout" target="_blank">https://tools.google.com/dlpage/gaoptout</a>.
51+
',
52+
]);
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
/**
3+
*
4+
* Google Analytics extension for the phpBB Forum Software package.
5+
*
6+
* @copyright (c) 2025 phpBB Limited <https://www.phpbb.com>
7+
* @license GNU General Public License, version 2 (GPL-2.0)
8+
*
9+
*/
10+
11+
/**
12+
* DO NOT CHANGE
13+
*/
14+
if (!defined('IN_PHPBB'))
15+
{
16+
exit;
17+
}
18+
19+
if (empty($lang) || !is_array($lang))
20+
{
21+
$lang = [];
22+
}
23+
24+
// DEVELOPERS PLEASE NOTE
25+
//
26+
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
27+
//
28+
// Placeholders can now contain order information, e.g. instead of
29+
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
30+
// translators to re-order the output of data while ensuring it remains correct
31+
//
32+
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
33+
// equally where a string contains only two placeholders which are used to wrap text
34+
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
35+
//
36+
// Some characters you may want to copy&paste:
37+
// ’ » “ ” …
38+
//
39+
40+
$lang = array_merge($lang, [
41+
'PHPBB_ANALYTICS_PRIVACY_POLICY' => '
42+
<br><br>
43+
<h3>Analytics</h3>
44+
“%1$s” may use Google Analytics, a web analytics service provided by Google LLC (“Google”), to help us understand how visitors use the site. Google Analytics uses cookies and similar technologies to collect information about your interactions with the site, including the pages you visit, the time spent on each page, and general usage patterns.
45+
<br><br>
46+
The information generated by these cookies about your use of “%1$s” (including your IP address) is transmitted to and stored by Google on servers in the United States or other locations. Google uses this information to evaluate your use of the site, compile reports on website activity for us, and provide other services relating to website activity and internet usage.
47+
<br><br>
48+
Google may also transfer this information to third parties where required to do so by law, or where such third parties process the information on Google’s behalf. To learn more about how Google collects and processes data, please see Google’s Privacy Policy at: <a href="https://policies.google.com/privacy" target="_blank">https://policies.google.com/privacy</a>.
49+
<br><br>
50+
You can opt out of Google Analytics by installing the Google Analytics opt-out browser add-on, available at: <a href="https://tools.google.com/dlpage/gaoptout" target="_blank">https://tools.google.com/dlpage/gaoptout</a>.
51+
',
52+
]);
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
/**
3+
*
4+
* Google Analytics extension for the phpBB Forum Software package.
5+
*
6+
* @copyright (c) 2025 phpBB Limited <https://www.phpbb.com>
7+
* @license GNU General Public License, version 2 (GPL-2.0)
8+
*
9+
*/
10+
11+
/**
12+
* DO NOT CHANGE
13+
*/
14+
if (!defined('IN_PHPBB'))
15+
{
16+
exit;
17+
}
18+
19+
if (empty($lang) || !is_array($lang))
20+
{
21+
$lang = [];
22+
}
23+
24+
// DEVELOPERS PLEASE NOTE
25+
//
26+
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
27+
//
28+
// Placeholders can now contain order information, e.g. instead of
29+
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
30+
// translators to re-order the output of data while ensuring it remains correct
31+
//
32+
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
33+
// equally where a string contains only two placeholders which are used to wrap text
34+
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
35+
//
36+
// Some characters you may want to copy&paste:
37+
// ’ » “ ” …
38+
//
39+
40+
$lang = array_merge($lang, [
41+
'PHPBB_ANALYTICS_PRIVACY_POLICY' => '
42+
<br><br>
43+
<h3>Analytics</h3>
44+
“%1$s” may use Google Analytics, a web analytics service provided by Google LLC (“Google”), to help us understand how visitors use the site. Google Analytics uses cookies and similar technologies to collect information about your interactions with the site, including the pages you visit, the time spent on each page, and general usage patterns.
45+
<br><br>
46+
The information generated by these cookies about your use of “%1$s” (including your IP address) is transmitted to and stored by Google on servers in the United States or other locations. Google uses this information to evaluate your use of the site, compile reports on website activity for us, and provide other services relating to website activity and internet usage.
47+
<br><br>
48+
Google may also transfer this information to third parties where required to do so by law, or where such third parties process the information on Google’s behalf. To learn more about how Google collects and processes data, please see Google’s Privacy Policy at: <a href="https://policies.google.com/privacy" target="_blank">https://policies.google.com/privacy</a>.
49+
<br><br>
50+
You can opt out of Google Analytics by installing the Google Analytics opt-out browser add-on, available at: <a href="https://tools.google.com/dlpage/gaoptout" target="_blank">https://tools.google.com/dlpage/gaoptout</a>.
51+
',
52+
]);
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
/**
3+
*
4+
* Google Analytics extension for the phpBB Forum Software package.
5+
*
6+
* @copyright (c) 2025 phpBB Limited <https://www.phpbb.com>
7+
* @license GNU General Public License, version 2 (GPL-2.0)
8+
*
9+
*/
10+
11+
/**
12+
* DO NOT CHANGE
13+
*/
14+
if (!defined('IN_PHPBB'))
15+
{
16+
exit;
17+
}
18+
19+
if (empty($lang) || !is_array($lang))
20+
{
21+
$lang = [];
22+
}
23+
24+
// DEVELOPERS PLEASE NOTE
25+
//
26+
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
27+
//
28+
// Placeholders can now contain order information, e.g. instead of
29+
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
30+
// translators to re-order the output of data while ensuring it remains correct
31+
//
32+
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
33+
// equally where a string contains only two placeholders which are used to wrap text
34+
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
35+
//
36+
// Some characters you may want to copy&paste:
37+
// ’ » “ ” …
38+
//
39+
40+
$lang = array_merge($lang, [
41+
'PHPBB_ANALYTICS_PRIVACY_POLICY' => '
42+
<br><br>
43+
<h3>Analytics</h3>
44+
“%1$s” may use Google Analytics, a web analytics service provided by Google LLC (“Google”), to help us understand how visitors use the site. Google Analytics uses cookies and similar technologies to collect information about your interactions with the site, including the pages you visit, the time spent on each page, and general usage patterns.
45+
<br><br>
46+
The information generated by these cookies about your use of “%1$s” (including your IP address) is transmitted to and stored by Google on servers in the United States or other locations. Google uses this information to evaluate your use of the site, compile reports on website activity for us, and provide other services relating to website activity and internet usage.
47+
<br><br>
48+
Google may also transfer this information to third parties where required to do so by law, or where such third parties process the information on Google’s behalf. To learn more about how Google collects and processes data, please see Google’s Privacy Policy at: <a href="https://policies.google.com/privacy" target="_blank">https://policies.google.com/privacy</a>.
49+
<br><br>
50+
You can opt out of Google Analytics by installing the Google Analytics opt-out browser add-on, available at: <a href="https://tools.google.com/dlpage/gaoptout" target="_blank">https://tools.google.com/dlpage/gaoptout</a>.
51+
',
52+
]);
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
<?php
2+
/**
3+
*
4+
* Google Analytics extension for the phpBB Forum Software package.
5+
*
6+
* @copyright (c) 2025 phpBB Limited <https://www.phpbb.com>
7+
* @license GNU General Public License, version 2 (GPL-2.0)
8+
*
9+
*/
10+
11+
/**
12+
* DO NOT CHANGE
13+
*/
14+
if (!defined('IN_PHPBB'))
15+
{
16+
exit;
17+
}
18+
19+
if (empty($lang) || !is_array($lang))
20+
{
21+
$lang = [];
22+
}
23+
24+
// DEVELOPERS PLEASE NOTE
25+
//
26+
// All language files should use UTF-8 as their encoding and the files must not contain a BOM.
27+
//
28+
// Placeholders can now contain order information, e.g. instead of
29+
// 'Page %s of %s' you can (and should) write 'Page %1$s of %2$s', this allows
30+
// translators to re-order the output of data while ensuring it remains correct
31+
//
32+
// You do not need this where single placeholders are used, e.g. 'Message %d' is fine
33+
// equally where a string contains only two placeholders which are used to wrap text
34+
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
35+
//
36+
// Some characters you may want to copy&paste:
37+
// ’ » “ ” …
38+
//
39+
40+
$lang = array_merge($lang, [
41+
'PHPBB_ANALYTICS_PRIVACY_POLICY' => '
42+
<br><br>
43+
<h3>Analytics</h3>
44+
“%1$s” may use Google Analytics, a web analytics service provided by Google LLC (“Google”), to help us understand how visitors use the site. Google Analytics uses cookies and similar technologies to collect information about your interactions with the site, including the pages you visit, the time spent on each page, and general usage patterns.
45+
<br><br>
46+
The information generated by these cookies about your use of “%1$s” (including your IP address) is transmitted to and stored by Google on servers in the United States or other locations. Google uses this information to evaluate your use of the site, compile reports on website activity for us, and provide other services relating to website activity and internet usage.
47+
<br><br>
48+
Google may also transfer this information to third parties where required to do so by law, or where such third parties process the information on Google’s behalf. To learn more about how Google collects and processes data, please see Google’s Privacy Policy at: <a href="https://policies.google.com/privacy" target="_blank">https://policies.google.com/privacy</a>.
49+
<br><br>
50+
You can opt out of Google Analytics by installing the Google Analytics opt-out browser add-on, available at: <a href="https://tools.google.com/dlpage/gaoptout" target="_blank">https://tools.google.com/dlpage/gaoptout</a>.
51+
',
52+
]);

0 commit comments

Comments
 (0)