analytics-debugger / ga4mp

GA4MP
MIT License
40 stars 11 forks source link

Support for automatically collected events #18

Closed mk1024 closed 1 year ago

mk1024 commented 1 year ago

Thanks for this little gem! :-) I've set up a test website with ga4mp and it looks like all events (e.g. page_view) have to be triggered manually.

  1. Are there any plans to handle some common events automatically (page_view, click, scroll, user_engagement)?
  2. Can these default events be sent via ga4track.trackEvent('click', ...) or can we only send custom events?

(see Analytics Help - Automatically collected events)

thyngster commented 1 year ago

Hi, the purpose of this library is not to replicate the existing GA4 tracking features.

Instead, it aims to provide an interface that allows you to send data/events to the GA4's public endpoint protocol (to bypass some of the limitations of the official measurement protocol) while offering a lightweight and privacy-friendly approach to measuring your apps or website.

Unlike in Universal Analytics, GA4 does not have a specific data model defined. Therefore, you are responsible for managing events, session states, cross-domain tracking or other related tasks.

mk1024 commented 1 year ago

I'm currently using a server-side lib for Universal Analytics that uses Measurement Protocol to send pageviews, events and timings (C#).

There is also a complete MP implementation for UA4, but it looks like Google decided to not support setting IPs, geo data and user agents on purpose. Since using MP for GA4 is not an option for visitor tracking, I'll have to use the public endpoint of the client side.

Your project looks like a good replacement on the client side. Since I only need some basic events, it could be a nice alternative to gtag.js or Elbwalker.

When I only need pageviews and some basic events, is there anything I have to implement myself to track users and sessions correctly?