nystudio107 / craft-instantanalytics-ga4

Instant Analytics brings full Google GA4 server-side analytics support to your Twig templates and automatic Craft Commerce integration
Other
3 stars 4 forks source link

Send commerce events aren't being transformed to monetization report #20

Closed jripmeester closed 10 months ago

jripmeester commented 10 months ago

Instant Analytics is correctly sending events to GA4. Include the commerce events (add_to_cart, purchase, etc). But these events aren't transformed to the monetization report. Probably because some required fields are missing (for example; currency).

To reproduce

Steps to reproduce the behaviour:

  1. Install Instant Analytics GA4 in a Craft 3 with Commerce 3 enviroment
  2. Setup the correct GA4 keys to get the events going.
  3. Add a product to the cart and complete the order
  4. In GA4 you'll sent the events being registered but no records are added to the monetization report

Expected behaviour

The events that are registered should be included in the Monetization report.

Links

Here's an overview of the required fields per event https://developers.google.com/analytics/devguides/collection/ga4/reference/events?client_type=gtag#add_to_cart Here the notes indicate why the events are not included in the report https://support.google.com/analytics/answer/12924131?hl=en&ref_topic=13818299&sjid=7744061481099581986-EU

Versions

janhenckens commented 10 months ago

Came here to report a similar issue. We see events in GA4 but are missing pricing data. Checked our setup (measurement id, api key) and the other settings are all on automatic.

khalwat commented 10 months ago

Addressed in:

Craft 3 -> Version 3.0.0-beta.4: https://github.com/nystudio107/craft-instantanalytics-ga4/releases/tag/3.0.0-beta.4

Craft 4 -> Version 4.0.0-beta.5: https://github.com/nystudio107/craft-instantanalytics-ga4/releases/tag/4.0.0-beta.5

jripmeester commented 10 months ago

Updated! Thanks @khalwat!

jripmeester commented 10 months ago

@khalwat Sorry to open this one up again. The view_item event isn't being registered in the monetization report either. The currency value also needs to be added to the addProductDataFromProductOrVariant function. When i add that in the code the event gets handled correctly.

khalwat commented 10 months ago

@jripmeester on it

khalwat commented 10 months ago

Addressed & released:

Craft 3: https://github.com/nystudio107/craft-instantanalytics-ga4/releases/tag/3.0.0

Craft 4: https://github.com/nystudio107/craft-instantanalytics-ga4/releases/tag/4.0.0