[Koha] Google Analytics 4 and Koha 22.05, help needed
Lucas Gass
lucas at bywatersolutions.com
Wed Nov 16 07:13:45 NZDT 2022
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 at 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 at 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 at gmail.com>
> > > wrote:
> > >
> > >> Put it in the opaccredits.
> > >>
> > >> El mar, 15 nov 2022 a las 14:35, Elaine Bradtke (<eb at 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 at 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 at lists.katipo.co.nz
> > > Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
> > _______________________________________________
> >
> > Koha mailing list http://koha-community.org
> > Koha at lists.katipo.co.nz
> > Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
> >
> _______________________________________________
>
> Koha mailing list http://koha-community.org
> Koha at lists.katipo.co.nz
> Unsubscribe: https://lists.katipo.co.nz/mailman/listinfo/koha
>
--
Lucas Gass
Web Developer
More information about the Koha
mailing list