joshdk/google-analytics-proxy

Why is the proxy limited to only 1 property/trackingID? And to version 1?

Opened this issue · 1 comments

sneko commented

Hi @joshdk ,

I'm wondering why it's not possible to leave the choice of the destination property to the frontend? Is there any limitation for that? Same for the version hardcoded to "1"?

The proxy could totally rely on the request from the user no? For example by receiving ?v=2&tid=G-AAAAAAA&gtm=2o we can forward to the version "2" with the right trackingID. And for more security the docker could take as environment variable a whitelist of multiple trackingIDs?

What do you think?

(I did not try for now, just looking around which proxy would fit forwarding to GA4 with geolocation...)

Thank you,

👋🏻 Hello @sneko! Thanks for the questions. To answer them in no particular order:


the version hardcoded to "1"

This project was written targeting the older GA version because I had several existing properties that had various pieces of custom tracking code that I wanted to eliminate.

GA4 isn't currently supported, but that's only because I haven't had time to implement it yet.

why it's not possible to leave the choice of the destination property to the frontend?

This project is primarily intended (as this is how I'm using it) to be deployed as a sidecar container within an existing pod, where that pod serves a single site (or property). The solution to supporting multiple properties is to deploy them as multiple pods, and have individual proxy sidecars for each.

Multiple (vhost-style?) property selection could potentially work, but you would need to maintain a mapping of domains to property IDs.

Is there any limitation for that?

The general goal of this project is to make the collection of analytics completely transparent to both the user agent, as well as to the webservice. Passing GA property IDs back and forth would violate both of these rules, at which point you might as well just use gtag.js etc.


Hopefully that provides some insight. I'm also happy to talk about potential improvements or review pull requests 🙂

Cheers!