ga-lite
ga-lite copied to clipboard
Customizable endpoint URL and User Language
I noticed some parameters are hard-coded, specifically, the Google Analytics endpoint URL (https://www.google-analytics.com/collect
) and User Language (ul
):
https://github.com/jehna/ga-lite/blob/6b467e592b9880d9f8eb270f20c57e74176b3c6c/src/get-base-url.js#L5-L7
It would be awesome to be able to:
- Make
ul
use actual language provided by the user agent (e.g.navigator.language
) - Use a custom endpoint URL to avoid people blocking the official endpoint
Thank you for opening the issue. Good catch on the ul
parameter! This should now be fixeed with #462
Using a custom endpoint would make sense — it would allow for routing the requests from your own domain (getting around any third-party restrictions), and even creating an alternative backends for the ga protocol.
How would you like to pass the endpoint url to ga-lite? How about something like:
galite('create', 'UA-XXXXXXXX-X', 'auto');
galite('set-endpoint', '/my-custom-collect-endpoint');
galite('send', 'pageview');
This would be majorly useful. Looking at using this script to proxy traffic through a cloudflare worker.