theiconic / php-ga-measurement-protocol

Send data to Google Analytics from the server using PHP. Implements GA measurement protocol.
MIT License
655 stars 136 forks source link

Google Analytics 4 #94

Open ZherebcovSergey opened 3 years ago

ZherebcovSergey commented 3 years ago

At the moment I am using the library to work with Google Analytics. Will it work with version 4? And what you need to do? Would it be sufficient to specify the version?

$analytics = new Analytics(true);
$analytics->setProtocolVersion ('4');
ZherebcovSergey commented 3 years ago

This functionality means https://ga-dev-tools.appspot.com/ga4-event-builder/

dilab commented 3 years ago

@ZherebcovSergey have you tested out? is this library working with GA4?

mindaugasva commented 3 years ago

I have tested today and it's not working with GA4...

yellow1912 commented 3 years ago

Any update on this? Would be nice if we can make it work with the new version.

AronSEPAIT commented 2 years ago

Any updates on this? I am also curious to know if this works with GA4

chludwig commented 2 years ago

Are there any plans to make this library compatible to the latest GA4 Measurement Protocol (Google Analytics 4) ?

Just a note on this comment:

This functionality means https://ga-dev-tools.appspot.com/ga4-event-builder/

The source of this page can be found here (https://github.com/googleanalytics/ga-dev-tools) and it is a frontend solution in TypeScript (JS).

atticus7 commented 2 years ago

This would be good to know as Universal Analytics will no longer be supported as of July 2023. And if not, any suggestions of alternative approaches would be gratefully received. I've just implemented this on a site which uses "virtual pages" using AJAX and it works really well.

san-kumar commented 2 years ago

This would be good to know as Universal Analytics will no longer be supported as of July 2023. And if not, any suggestions of alternative approaches would be gratefully received. I've just implemented this on a site which uses "virtual pages" using AJAX and it works really well.

I think this library seems to supports GA4. You can check it too

https://github.com/br33f/php-GA4-Measurement-Protocol

atticus7 commented 2 years ago

This would be good to know as Universal Analytics will no longer be supported as of July 2023. And if not, any suggestions of alternative approaches would be gratefully received. I've just implemented this on a site which uses "virtual pages" using AJAX and it works really well.

I think this library seems to supports GA4. You can check it too

https://github.com/br33f/php-GA4-Measurement-Protocol

Thank you. That looks promising!

8ctopus commented 1 year ago

There's also this package which looks promising https://github.com/aawnu/php-ga4