OneZoom / OZtree

OneZoom Tree of Life Explorer
Other
87 stars 18 forks source link

Cookie pop-up for google analytics usage #722

Open lentinj opened 6 months ago

lentinj commented 6 months ago

Add a cookie pop-up if GA is being used.

jrosindell commented 6 months ago

We spoke about this at the last board meeting and agreed it should be done. However, can we please tweak the text in the cookie message to mention our identity as a registered not for profit organisation. E.g. we should say "OneZoom, a charitable incorporated organisation (non-profit) registered in the UK"

lentinj commented 6 months ago

@jrosindell the above wraps GA in a cookiecontrol config. To be able to use it, we'll need API keys for both beta & live domains.

You'll need to sign up here https://www.civicuk.com/cookie-control/user-area/, set the domain in the "Domains" tab, and get the API key from the "Licences" tab.

lentinj commented 6 months ago

https://github.com/OneZoom/OZtree/blob/ed8ef3a2b39640301e7430d999ae8376fbd8caee/views/analytics.html#L26-L32

lentinj commented 6 months ago

https://github.com/OneZoom/OZtree/blob/main/private/appconfig.ini.example#L77-L88

jrosindell commented 2 weeks ago

This seems to be working now, though outstanding actions on it might be to store non personal usage statistics that don't require cookies and are held on server side (e.g. number of plays for tours which is in the DB but not currently used, page views for pages etc) also to review if we can what proportion of users accept cookies to help us track usage and which do not. When I tried this on mobile the message disappeared in a way that wasn't clear to me if I'd accepted cookies or not. None of these things need immediate attention but I thought it was important to note them

lentinj commented 2 weeks ago

number of plays for tours which is in the DB but not currently used, page views for pages

We should mine those stats out of the NGINX logs, to avoid excessive writes (and thus locking) to the database. Pumping the figures back into the DB would certainly be possible, however it might be simpler to get something up and running with goaccess generating a report for a subset of queries.

review if we can what proportion of users accept cookies to help us track usage and which do not

This is a paid feature of cookie control, so might be easiest to sign up for a single year, and then at least an informed decision can be made on what to do next.