Skip to content

Conversation

@miguelpeixe
Copy link
Member

@miguelpeixe miguelpeixe commented Nov 6, 2023

All Submissions:

Changes proposed in this Pull Request:

1200550061930446-as-1205734635694818

Creates gate_interaction data events with the following schema:

Name Type Obs
gate_post_id int
action string Either seen, form_submission_received, form_submission_success or form_submission_failure
action_type string Either paid_membership or registration. Not applicable when action is seen
referer string
order_id int Only applicable when action_type is paid_membership
product_id int Only applicable when action_type is paid_membership
amount float Only applicable when action_type is paid_membership
currency string Only applicable when action_type is paid_membership

To allow tracking form interactions inside the gate, a script injects a hidden memberships_content_gate input to forms inside the gate. This is passed by the reader registration or the modal checkout logic so it can finally get picked up by the data event listeners.

It also implements the integration with the ga4 connector, which will include additional parameters to the GA event: logged_in, is_reader, and email_hash.

How to test the changes in this Pull Request:

  1. Checkout this branch and feat(modal-checkout): add filter to cart item data newspack-blocks#1590
  2. Make sure you have GA4 connected with the wp options ga4_measurement_id and ga4_measurement_protocol_secret configured
  3. Set up a membership plan restricted by user registration and configure an inline content gate with a reg. wall (reader registration block)
  4. Go through the gate anonymously and make sure your session allows 3rd party cookies
  5. Visit GA's realtime dashboard, wait until the events are sent and confirm you get 3 np_gate_interaction events: seen and form_submission_received and form_submission_success with action_type set to registration and the correct referer
  6. Change the membership plan to grant access through a subscription product
  7. Change the content gate from "inline" to the "overlay" style
  8. Repeat steps 3 and 4 but confirm that this time the action_type is paid_membership
  9. Confirm the event also includes order_id, product_id, amount and currency

Other information:

  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes, as applicable?
  • Have you successfully ran tests with your changes locally?

@miguelpeixe miguelpeixe marked this pull request as ready for review November 9, 2023 14:46
@miguelpeixe miguelpeixe requested a review from a team as a code owner November 9, 2023 14:46
@miguelpeixe miguelpeixe self-assigned this Nov 9, 2023
@miguelpeixe miguelpeixe added the [Status] Needs Review The issue or pull request needs to be reviewed label Nov 9, 2023
@leogermani leogermani self-requested a review November 14, 2023 20:19
Copy link
Contributor

@leogermani leogermani left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Everything works great!

One thing I noticed is: After I had 2 successful form submissions (one via registration and one product purchase), I noticed that the product_id parameter appears to have two entries with the product ID (where it should be only one)

image

This might be just a glitch of the Realtime Report... I think to confirm it we'll need to look at how the data looks in BigQuery...

But maybe if we simply didn't sent the parameter when they are empty, instead of sending empry strings? WDYT?

@github-actions github-actions bot added [Status] Approved The pull request has been reviewed and is ready to merge and removed [Status] Needs Review The issue or pull request needs to be reviewed labels Nov 14, 2023
@miguelpeixe
Copy link
Member Author

miguelpeixe commented Nov 17, 2023

The 2 events with product_id are from the form_submission_received and form_submission_success for the same paid_membership action type.

@miguelpeixe miguelpeixe merged commit 298fd7c into master Nov 17, 2023
@miguelpeixe miguelpeixe deleted the feat/content-gate-track-forms branch November 17, 2023 12:33
matticbot pushed a commit that referenced this pull request Nov 30, 2023
# [2.12.0-alpha.1](v2.11.3...v2.12.0-alpha.1) (2023-11-30)

### Bug Fixes

* **checkout:** move stripe's cover fee placement ([#2767](#2767)) ([5f8b539](5f8b539))
* **data-events:** no longer use ActionScheduler for dispatches ([#2755](#2755)) ([975ab96](975ab96))
* **metering:** restrict comments on gated content ([#2751](#2751)) ([1bfc6f0](1bfc6f0))
* **recaptcha:** refresh token on checkout error ([#2769](#2769)) ([f22e8bd](f22e8bd))

### Features

* add filters for assets enqueueing ([#2768](#2768)) ([fcad059](fcad059))
* **authentication:** rate limit magic links and OTP generation ([#2765](#2765)) ([1252515](1252515))
* **campaigns:** mark duplicate segments ([cb5b527](cb5b527))
* **data-events:** track content gate interactions ([#2740](#2740)) ([298fd7c](298fd7c))
* **donations:** disable coupons for donation checkout ([#2770](#2770)) ([6051429](6051429))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 2.12.0-alpha.1 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

matticbot pushed a commit that referenced this pull request Dec 11, 2023
# [2.12.0](v2.11.6...v2.12.0) (2023-12-11)

### Bug Fixes

* **checkout:** move stripe's cover fee placement ([#2767](#2767)) ([5f8b539](5f8b539))
* **data-events:** no longer use ActionScheduler for dispatches ([#2755](#2755)) ([975ab96](975ab96))
* **metering:** restrict comments on gated content ([#2751](#2751)) ([1bfc6f0](1bfc6f0))
* **recaptcha:** refresh token on checkout error ([#2769](#2769)) ([f22e8bd](f22e8bd))

### Features

* add filters for assets enqueueing ([#2768](#2768)) ([fcad059](fcad059))
* **authentication:** rate limit magic links and OTP generation ([#2765](#2765)) ([1252515](1252515))
* **campaigns:** mark duplicate segments ([cb5b527](cb5b527))
* **data-events:** track content gate interactions ([#2740](#2740)) ([298fd7c](298fd7c))
* **donations:** disable coupons for donation checkout ([#2770](#2770)) ([6051429](6051429))
@matticbot
Copy link
Contributor

🎉 This PR is included in version 2.12.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

released on @alpha released [Status] Approved The pull request has been reviewed and is ready to merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants