diazo ignores the JavaScript for web statistics
Question
I have a plone 4.2.1 site and I am using various diazo themes. I also use Piwik for web statistics. Unfortunately the javascript for web statistics is being utterly ignored when one of the diazo themes is installed. I have tried to edit the rules.xml file as suggested in https://groups.google.com/forum/?fromgroups=#!topic/plone-users/VM4b51ergFA, but adding
<!-- Google Analytics JavaScript -->
<after theme-children="/html/body"
content="/html/body/div[@id='visual-portal-wrapper']/div/script" />
does not work for me.
Is there any other option which I can use to fix this issue?
Thanks, Julian
Solution
The viewlet plone.analytics is rendered in the footer viewlet manager:
<browser:viewlet
name="plone.analytics"
manager="plone.app.layout.viewlets.interfaces.IPortalFooter"
class=".view.AnalyticsViewlet"
permission="zope2.View"
/>
The snippet is rendered as it is, so you can identify your script tag in the way you want.
You shoud try
<script id="plone-analytics" ...>YOUR SCRIPT...</script>
And modify the rules.xml to put #plone-analytics in your footer
In Plone 4.2 at least the plone.analytics is not in the visual-portal-wrapper so the rule you try will not work.