Bug 13247 - opacuserjs is not compatible with tracking's tools like Piwik
Summary: opacuserjs is not compatible with tracking's tools like Piwik
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Templates (show other bugs)
Version: Main
Hardware: All All
: P3 enhancement (vote)
Assignee: Stéphane Delaune
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-11-13 13:42 UTC by Stéphane Delaune
Modified: 2015-06-04 23:33 UTC (History)
1 user (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
proposed patch (1.19 KB, patch)
2014-11-13 13:55 UTC, Stéphane Delaune
Details | Diff | Splinter Review
new proposed patch (1.21 KB, patch)
2014-11-14 07:54 UTC, Stéphane Delaune
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 13247 - Move opacuserjs at the end of opac-bottom.inc (1.31 KB, patch)
2014-11-14 17:23 UTC, Owen Leonard
Details | Diff | Splinter Review
[PASSED QA] Bug 13247 - Move opacuserjs at the end of opac-bottom.inc (1.45 KB, patch)
2014-11-16 09:44 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Stéphane Delaune 2014-11-13 13:42:26 UTC
some tools needs to add javascript just before the </body> tag .This is particularly the case of statistical :
- Piwik (the page "http://developer.piwik.org/api-reference/tracking-javascript" indicates "copy and paste the JavaScript Tracking code into your pages, just before the </body> tag")

- Google Analytics (the page "https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingOverview?hl=fr" indicates "This tracking code snippet should be included in your site's pages so that it appears at the bottom of the page's HTML (or generated-HTML) structure, before the closing <body> tag.")

To use these tools with the syspref "opacuserjs", its use should be moved to the end of opac-bottom.inc
Comment 1 Stéphane Delaune 2014-11-13 13:55:03 UTC Comment hidden (obsolete)
Comment 2 Mark Tompsett 2014-11-13 14:22:29 UTC
Comment on attachment 33521 [details] [review]
proposed patch

Review of attachment 33521 [details] [review]:
-----------------------------------------------------------------

::: koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-bottom.inc
@@ +238,5 @@
>  [% PROCESS jsinclude %]
>  
> +<script type="text/javascript">
> +    //<![CDATA[
> +    [% IF ( opacuserjs ) %][% opacuserjs %][% END %]

Wouldn't it make more sense to put the IF and END around the entire script? Why generate a hollow script section?
Comment 3 Owen Leonard 2014-11-13 14:58:09 UTC
(In reply to M. Tompsett from comment #2)

> Wouldn't it make more sense to put the IF and END around the entire script?
> Why generate a hollow script section?

I agree. Other than that I think this change will work.
Comment 4 Stéphane Delaune 2014-11-14 07:54:06 UTC Comment hidden (obsolete)
Comment 5 Owen Leonard 2014-11-14 17:23:53 UTC Comment hidden (obsolete)
Comment 6 Katrin Fischer 2014-11-16 09:44:54 UTC
Created attachment 33600 [details] [review]
[PASSED QA] Bug 13247 - Move opacuserjs at the end of opac-bottom.inc

This patch makes opacuserjs compatible with tracking tools like Piwik

Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Small change to enable use of opacuserjs for statistical
tools like Piwik by moving it right above </body>.
Works as described.
Comment 7 Tomás Cohen Arazi 2014-11-21 23:34:24 UTC
Patch pushed to master.

Thanks Stephane!