on my site I want to include the number of active users (real-time visitors) somewhere on a banner or whatsoever. The only problem is, I can only do it via Javascript (no PHP; Java, Phyton...), but I don't want users to sign up to see it. I spent hours checking the Google Analytics Reporting API and I understand that what I want to achieve is probably not possible, but wanted to check whether some of you has found workarounds that could work for me, too.
Thanks much to everyone. A.
You cannot use the GA API without a form of authentication, therefore connecting GA directly to your website without client login isn't possible.
As a workaround, you can use a middleware solution to pull data from the GA API, and then pull data from that midddleware to your website. Here is an example:
GA API ---> Google Sheets ---> Website
https://docs.google.com/spreadsheets/d/e/{some-uid}/pub?gid=0&single=true&output=csv
Note: you probably don't have to do step 2 if you're careful, and can publish as CSV your sheet from steo 1 directly: since it's a CSV export, people cannot get to the original spreadsheet so no security risk. But just to be on the safe side (eg you could publish the whole spreadsheet by mistake), I would do step 2.
As for which middleware you want to use, there's probably an infinite number of options :)