Automattic / newspack-plugin

An advanced open-source publishing and revenue-generating platform for news organizations.
https://newspack.com
GNU General Public License v2.0
325 stars 49 forks source link

feat(ras-acc): add modal checkout GA4 events #3179

Closed laurelfulford closed 1 month ago

laurelfulford commented 3 months ago

All Submissions:

Changes proposed in this Pull Request:

Along with https://github.com/Automattic/newspack-blocks/pull/1768, adds GA4 tracking events to the modal checkout.

This is my first time working with our GA4 Data Events, so the exact information being tracked when and why could use some special attention. I'm adding @kmwilkerson as a tester just to make sure it gets her eyes, too!

The following should be tracked:

See 1205234045751551-as-1206525965459152

How to test the changes in this Pull Request:

  1. Ideally start on a test site connected to GA4.
  2. Apply this PR and https://github.com/Automattic/newspack-blocks/pull/1768, and run npm run build.
  3. Optionally log events by adding error_log( print_r( $event, true ) ); after this line.
  4. Set up a couple checkout situations -- ideally a Donate Block, and at least one Checkout Button Block.
  5. Run through the checkout and confirm what's being tracked -- the following params should be tracked for the np_modal_checkout_interaction event, for each step. Some are already baked in to the Data Events, so I bolded the ones added for this event, and I added notes where I wasn't 100% sure what was being captured was correct:

When the modal checkout is opened from a Donation or Checkout Button block:

When the Continue Button is clicked:

Click button to complete purchase:

Other information:

laurelfulford commented 2 months ago

Thanks for the review @chickenn00dle! This should (largely) be ready for review again, but I'm going to confirm some of the GA4 data stuff -- if you'd like to leave it 'til then, I can update here when that bit has been confirmed 🙂

laurelfulford commented 1 month ago

Leaving this one open for now, but I've started reworking this PR here to have a fresh start and add front-end events.

laurelfulford commented 1 month ago

Closing in favour of the reworked draft: https://github.com/Automattic/newspack-plugin/pull/3297