From ee6a43e96e006c1fb7093987e0a57b5aa105b564 Mon Sep 17 00:00:00 2001 From: Alexander Summa Date: Mon, 5 Dec 2016 13:46:47 +0100 Subject: [PATCH] Do not show the tracking code with empty or invalid settings The tracking code was displayed even if no idSite or host was configured in the backend module (or manually in Settings.yaml). This fixes this by adding two conditions that check if both host and idSite parameters are set. --- Resources/Private/TypoScript/Prototypes/TrackingCode.ts2 | 9 ++++++++- Resources/Private/TypoScript/Root.ts2 | 6 +----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/Resources/Private/TypoScript/Prototypes/TrackingCode.ts2 b/Resources/Private/TypoScript/Prototypes/TrackingCode.ts2 index 0b4e1cf..a391bb1 100644 --- a/Resources/Private/TypoScript/Prototypes/TrackingCode.ts2 +++ b/Resources/Private/TypoScript/Prototypes/TrackingCode.ts2 @@ -1,6 +1,13 @@ # A Piwik tracking code object # prototype(Portachtzig.Neos.Piwik:TrackingCode) < prototype(TYPO3.TypoScript:Template) { - @if.inLiveWorkspace = ${node.context.workspaceName == 'live'} templatePath = 'resource://Portachtzig.Neos.Piwik/Private/Templates/Prototypes/TrackingCode.html' + settings = ${Configuration.setting('Portachtzig.Neos.Piwik')} + + // Show tracking code only in live workspace and if all necessary parameters are set + @if { + inLiveWorkspace = ${node.context.workspaceName == 'live'} + hostIsSet = ${settings.host} + idSiteIsSet = ${settings.idSite} + } } \ No newline at end of file diff --git a/Resources/Private/TypoScript/Root.ts2 b/Resources/Private/TypoScript/Root.ts2 index 0e56a9c..1b0c4be 100644 --- a/Resources/Private/TypoScript/Root.ts2 +++ b/Resources/Private/TypoScript/Root.ts2 @@ -4,9 +4,5 @@ prototype(TYPO3.Neos:Page) { piwikTrackingCode = Portachtzig.Neos.Piwik:TrackingCode { # Google suggests to include the tracking code directly after the tag @position = 'end' - settings = ${Configuration.setting('Portachtzig.Neos.Piwik')} - } -} - - +} \ No newline at end of file