mikehardy / google-analytics-java

Open Source license compatible Java API for Google Analytics
8 stars 3 forks source link

Google Analytics 4 / GA4 compatibility #275

Open mikehardy opened 2 years ago

mikehardy commented 2 years ago

It appears there is a big shift coming in analytics for google and we need to implement a new measurement protocol:

https://support.google.com/analytics/answer/11583528 https://developers.google.com/analytics/devguides/collection/protocol/ga4

Current status is: work not started, basic feelers for collaboration out to people that might be interested in collaborating upstream or here

Current need is: should be done soon to start building hit history in GA4 data pools, AnkiDroid is still a "customer" of this lib and I maintain that so I need to either update this lib or find an OSS-license-compatible + Android-compatible GA4 implementation

marco-brandizi commented 1 year ago

Any news on this? I'm banging my head on GA4, which I'd like to use for tracking the requests to a Java API. No Java client seems available and worse, no decent Java example that shows bare HTTP invocations.

mikehardy commented 1 year ago

I'm agnostic on implementation language for bare HTTP invocations, any implementation would be useful to see how things work

I've not started at all on this though and likely won't have time for quite some time. Wish that weren't the case but I've got to be honest.

soundasleep commented 1 year ago

I'm joining the party... you'd expect it'd be easier to migrate away from UA if they're stopping data collection in less than nine months time.

How much of an architectural change do you expect UA -> GA4 might be for this library? Do you think it'd be as simple as replacing some of the internals but the API surface would stay consistent, or will GA4 require a rewrite of how client libraries report with GA?

mikehardy commented 1 year ago

Hey @soundasleep :wave: ! With apologies, I don't know - I haven't had any time to look at the documentation unfortunately so I'm not sure if this is a real conceptual shift in how to measure things or just new syntax or somewhere in between.

marco-brandizi commented 1 year ago

@mikehardy and anyone interested: because the July deadline is coming, I've had to start writing some client code for the new GA4 measurement protocol.

Here is what I have written so far, tests/usage here. My plan is to transfer that Java package into its own Maven project and repo (and obviously, to rename it more properly, not knetminer.server.* etc). I wouldn't mind if someone wants to do that bit before I have time for it.

Also, in addition to comments, it is still missing a couple of things that I still don't need and/or I still have to understand how exactly they work and to test, namely, user parameters and event items (see my comments and links). But at least, it's a start and I'm leaving this note so that possibly, we can avoid duplicated efforts.