Hi, One may create a new Koha plugin like this one for Matomo : https://github.com/biblibre/koha-plugin-opac-matomo Best regards, Le 15/11/2022 à 07:34, Elaine Bradtke a écrit :
We haven't been using Google Analytics on Koha, but we thought we would try it to see if it throws up any useful data. They're switching to a new system (Analytics 4). I thought I'd start there, but I haven't had any success in implementing it. Has anyone done this in 22.05 and if so could you help me out? I know nothing about JavaScript.
Here's what I've tried so far: I looked at Koha Geek's tip where it suggests we paste the site tag into opaccredits, but this doesn't seem to be System preference anymore http://kohageek.blogspot.com/2019/01/google-analytics-koha.html
From Bywater ( https://bywatersolutions.com/education/setting-up-google-analytics-with-koha ) – add the following to opacuserjs – change the track id to your Google ID
//Begin Google Analytics 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)
})(window,document,'script','https://www.google-analytics.com/analytics.js ','ga');
ga('create', 'trackID', 'auto');
ga('send', 'pageview');
//End Google Analytics script
This throws up syntax errors about missing semicolons, and 'expected an assignment of function call and instead saw an expression'
From new Google analytics – (our ID is xed out) - this throws up error messages about identifiers, operators and an unrecoverable syntax error.
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=XXXXXXX "></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'XXXXXXX');
</script>
Thanks for any help you can offer
Elaine Bradtke VWML <https://www.vwml.org> English Folk Dance and Song Society <https://www.efdss.org> Cecil Sharp House, 2 Regent's Park Road, London NW1 7AY Tel +44 (0) 20 7485 2206 (This number is for the English Folk Dance and Song Society in London, England. If you wish to phone me personally, send an e-mail first. I work off site) -------------------------------------------------------------------------- Registered Company No. 297142 Charity Registered in England and Wales No. 305999 _______________________________________________
Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
-- Fridolin SOMERS <fridolin.somers@biblibre.com> Software and system maintainer 🦄 BibLibre, France