Google Analytics 4 and Koha 22.05, help needed
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
Put it in the opaccredits. El mar, 15 nov 2022 a las 14:35, Elaine Bradtke (<eb@efdss.org>) escribió:
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
-- Tomás Cohen Arazi Theke Solutions (http://theke.io) ✆ +54 9351 3513384 GPG: B2F3C15F
"No system preferences matched your search for: opaccredits" Elaine VWML <https://vwml.org> On Tue, Nov 15, 2022 at 9:39 AM Tomas Cohen Arazi <tomascohen@gmail.com> wrote:
Put it in the opaccredits.
El mar, 15 nov 2022 a las 14:35, Elaine Bradtke (<eb@efdss.org>) escribió:
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
-- Tomás Cohen Arazi Theke Solutions (http://theke.io) ✆ +54 9351 3513384 GPG: B2F3C15F
Hi Elaine, opaccredits was moved to HTML customizations or if you are on an older version to the News tool. Hope this helps, Katrin On 15.11.22 18:41, Elaine Bradtke wrote:
"No system preferences matched your search for: opaccredits"
Elaine VWML <https://vwml.org>
On Tue, Nov 15, 2022 at 9:39 AM Tomas Cohen Arazi <tomascohen@gmail.com> wrote:
Put it in the opaccredits.
El mar, 15 nov 2022 a las 14:35, Elaine Bradtke (<eb@efdss.org>) escribió:
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
-- Tomás Cohen Arazi Theke Solutions (http://theke.io) ✆ +54 9351 3513384 GPG: B2F3C15F
_______________________________________________
Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
We're on 22.05 I'm looking in koha/tools/additional-contents.pl and still not seeing "opaccredits" There is an option to add a new entry. Should I do that? Elaine VWML <https://vwml.org> On Tue, Nov 15, 2022 at 9:45 AM Katrin Fischer <katrin.fischer.83@web.de> wrote:
Hi Elaine,
opaccredits was moved to HTML customizations or if you are on an older version to the News tool.
Hope this helps,
Katrin
On 15.11.22 18:41, Elaine Bradtke wrote:
"No system preferences matched your search for: opaccredits"
Elaine VWML <https://vwml.org>
On Tue, Nov 15, 2022 at 9:39 AM Tomas Cohen Arazi <tomascohen@gmail.com> wrote:
Put it in the opaccredits.
El mar, 15 nov 2022 a las 14:35, Elaine Bradtke (<eb@efdss.org>) escribió:
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
-- Tomás Cohen Arazi Theke Solutions (http://theke.io) ✆ +54 9351 3513384 GPG: B2F3C15F
_______________________________________________
Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
Elaine, Yes. If you do not have an 'opaccredits' HTML customization you should create a new one by selecting 'New entry' and setting the location to 'opaccredits'. For Google Analytics 4 you should use the following code: (replacing both instances of MYID with your tracking ID ) <script async src="https://www.googletagmanager.com/gtag/js?id=MYID"></ script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'MYID'); </script> On Tue, Nov 15, 2022 at 11:06 AM Elaine Bradtke <eb@efdss.org> wrote:
We're on 22.05 I'm looking in koha/tools/additional-contents.pl and still not seeing "opaccredits" There is an option to add a new entry. Should I do that? Elaine VWML <https://vwml.org>
On Tue, Nov 15, 2022 at 9:45 AM Katrin Fischer <katrin.fischer.83@web.de> wrote:
Hi Elaine,
opaccredits was moved to HTML customizations or if you are on an older version to the News tool.
Hope this helps,
Katrin
On 15.11.22 18:41, Elaine Bradtke wrote:
"No system preferences matched your search for: opaccredits"
Elaine VWML <https://vwml.org>
On Tue, Nov 15, 2022 at 9:39 AM Tomas Cohen Arazi < tomascohen@gmail.com> wrote:
Put it in the opaccredits.
El mar, 15 nov 2022 a las 14:35, Elaine Bradtke (<eb@efdss.org>) escribió:
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
-- Tomás Cohen Arazi Theke Solutions (http://theke.io) ✆ +54 9351 3513384 GPG: B2F3C15F
_______________________________________________
Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
_______________________________________________
Koha mailing list http://koha-community.org Koha@lists.katipo.co.nz Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
-- Lucas Gass Web Developer
Do you really want to tell Google what your patrons do on your Koha instance? Please consider to have a self hosted analytics tool like e.g. Matomo. Marc @mveron@tooting.ch Am 15.11.22 um 18:34 schrieb Elaine Bradtke:
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
Just adding that you can safely ignore OPACUserJS warnings if you know your script works; they do not prevent you from saving the field's value. I minify our OPACUserJS so it shows dozens of errors, but the code still functions. For something like this where you need to inject another script tag, you can do that in JavaScript first and then continue with the window.dataLayer stuff e.g. let d =d document , s = d.createElement('script') , t = d.getElementsByTagName('script')[0]; s.async = 1 s.src = 'https://www.googletagmanager.com/gtag/js?id={{your ID}}' t.parentNode.insertBefore(s, t) Best, ERIC PHETTEPLACE Systems Librarian, Libraries (he/him) ephetteplace@cca.edu | o 510.594.3660 (cca) *CCA is situated on the traditional unceded lands of the **Chochenyo and Ramaytush Ohlone** peoples.* Black-owned bookstores in Oakland: Ashay by the Bay <https://ashaybythebay.com/>, Marcus Books <https://www.facebook.com/marcus.books/> :(){ :|: & };: On Tue, Nov 15, 2022 at 9:35 AM Elaine Bradtke <eb@efdss.org> wrote:
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
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
participants (7)
-
Elaine Bradtke -
Eric Phetteplace -
Fridolin SOMERS -
Katrin Fischer -
Lucas Gass -
Marc Véron -
Tomas Cohen Arazi