Skip to content
This repository was archived by the owner on Aug 8, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Classes/Page/Part/FooterPart.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,10 @@ public function buildGoogleAnalyticsCode(array $tsServices, array $gaConf)
$this->cObj->data['gaCode'] = $gaCode;
$this->cObj->data['gaIsAnonymize'] = (int)!empty($gaConf['anonymizeIp']);
$this->cObj->data['gaDomainName'] = $gaConf['domainName'];
$this->cObj->data['gaOptOutCode'] = (int)!empty($gaConf['optoutCode']);
$this->cObj->data['gaCustomizationCode'] = $customCode;
$this->cObj->data['gaUseUniversalAnalytics'] = (int)!empty($gaConf['universalAnalytics']);


// Build code
$ret[] = $this->cObj->cObjGetSingle($gaConf['template'], $gaConf['template.']);
Expand Down
4 changes: 3 additions & 1 deletion Configuration/TypoScript/constants.txt
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,9 @@ plugin.metaseo {
services.googleAnalytics.domainName =
# cat=plugin.metaseo.services/page/08; type=boolean; label= Google Analytics Anonymize IP: Enable anonymize IP
services.googleAnalytics.anonymizeIp = 0
# cat=plugin.metaseo.services/page/09; type=boolean; label= Google Analytics Track Downloads: Track downloads (with javascript) (BETA!)
# cat=plugin.metaseo.services/page/09; type=boolean; label= Google Analytics Opt-Out-Code: Enable Opt-Out-Code
services.googleAnalytics.optoutCode = 0
# cat=plugin.metaseo.services/page/10; type=boolean; label= Google Analytics Track Downloads: Track downloads (with javascript) (BETA!)
services.googleAnalytics.trackDownloads = 0

# cat=plugin.metaseo.services/page/11; type=string; label= Piwik URL: Url to your piwik installation (eg. www.example.com/piwik/ - don't use http:// or https:// as prefix!)
Expand Down
7 changes: 6 additions & 1 deletion Configuration/TypoScript/setup.txt
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,8 @@ plugin.metaseo {

anonymizeIp = {$plugin.metaseo.services.googleAnalytics.anonymizeIp}
domainName = {$plugin.metaseo.services.googleAnalytics.domainName}

optoutCode = {$plugin.metaseo.services.googleAnalytics.optoutCode}

trackDownloads = {$plugin.metaseo.services.googleAnalytics.trackDownloads}
trackDownloadsScript = EXT:metaseo/Resources/Public/Frontend/JavaScript/GoogleAnalyticsTrackDownload.js
Expand All @@ -398,10 +400,13 @@ plugin.metaseo {

gaIsAnonymize = TEXT
gaIsAnonymize.field = gaIsAnonymize

gaDomainName = TEXT
gaDomainName.field = gaDomainName

gaOptOutCode = TEXT
gaOptOutCode.field = gaOptOutCode

gaUseUniversalAnalytics = TEXT
gaUseUniversalAnalytics.field = gaUseUniversalAnalytics
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
<f:format.raw value="<script>" />
<f:if condition="{gaOptOutCode}">
<f:format.raw value="
var gaProperty = '{gaCode}';
var disableStr = 'ga-disable-' + gaProperty;
if (document.cookie.indexOf(disableStr + '=true') > -1) { window[disableStr] = true; }
function gaOptout() {
document.cookie = disableStr + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
window[disableStr] = true;
}
" />
</f:if>
<f:format.raw value="
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
Expand Down