Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add tracking for Checkout Block additional fields #35418

Closed
wants to merge 7 commits into from

Conversation

senadir
Copy link
Contributor

@senadir senadir commented Feb 2, 2024

This issue is part of woocommerce/woocommerce#42116 it adds custom fields tracking, mainly adding how many fields there are in checkout and post checkout, their names, requirement, location, type, and value for post checkout events.

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

Does this pull request change what data or activity we track or use?

Testing instructions:

  • Add some custom Checkout fields like this snippet https://gist.github.com/senadir/bff581c05cb4a0d6a72cab4cd7ca5df1
  • Load up Checkout and Tracks Vigilante.
  • Make sure you're seeing 3 fields for field count and the fields values in both Checkout view event and product_checkout event.
  • Fill up the values and place an order.
  • Make sure you're seeing the fields in post checkout events like product_purchase and order_confirmation_view.
  • Disable the snippet and make sure the events are running fine still.

@senadir senadir added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Feature] WooCommerce Analytics [Package] Tracking This package no longer exists in the monorepo. It was merged into [Package] Connection. labels Feb 2, 2024
@senadir senadir requested a review from opr February 2, 2024 14:05
@senadir senadir self-assigned this Feb 2, 2024
@@ -0,0 +1,5 @@
Significance: patch
Type: other
Comment: We updated how we track Cart/Checkout
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is because I based my PR on #35139

@senadir senadir changed the base branch from trunk to add/move-woo-event-tracking-frontend February 2, 2024 14:06
Copy link
Contributor

github-actions bot commented Feb 2, 2024

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WordPress.com Simple site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin, and enable the add/custom-fields-tracking branch.

  • To test on Simple, run the following command on your sandbox:

    bin/jetpack-downloader test jetpack add/custom-fields-tracking
    

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions bot added the [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ label Feb 2, 2024
Copy link
Contributor

github-actions bot commented Feb 2, 2024

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Once your PR is ready for review, check one last time that all required checks appearing at the bottom of this PR are passing or skipped.
Then, add the "[Status] Needs Team Review" label and ask someone from your team review the code. Once reviewed, it can then be merged.
If you need an extra review from someone familiar with the codebase, you can update the labels from "[Status] Needs Team Review" to "[Status] Needs Review", and in that case Jetpack Approvers will do a final review of your PR.


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen daily.
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly. The next release is scheduled for April 2, 2024 (scheduled code freeze on April 1, 2024).

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@github-actions github-actions bot added the [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! label Feb 2, 2024
Comment on lines 587 to 632
return array(
$field_key,
$additional_fields_controller->get_field_location( $field_key ),
$field['type'],
$field['required'] ? '1' : '0',
);
},
Copy link
Contributor Author

Choose a reason for hiding this comment

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

opted here for a flat array with no keys to simplify querying it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we know that this really does simplify querying it? Have we checked with data teams about this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have not, but accessing array index is easier than object values, in python at least.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I agree on that but now someone has to remember/document what order these fields are in, is that fine/usual in data? I'm not sure which is why I'm asking, if that's the way things work normally then I'm fine with it

@senadir senadir added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Feb 2, 2024
@senadir senadir force-pushed the add/move-woo-event-tracking-frontend branch from 509aebb to 318f2a8 Compare February 7, 2024 15:45
$fields_count = count( $additional_fields );
$fields_data = array_map(
function ( $field_key, $field ) use ( $additional_fields_controller ) {
return array(
Copy link
Contributor

Choose a reason for hiding this comment

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

We should collect the label here too.

}
$data = array(
'fields_count' => $fields_count,
'fields' => wp_json_encode( $fields_data ),
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we ok with collecting the value here, seems like we could be collecting PII of shoppers if we do this? For example if an "alternative contact number" field is added, should we really be collecting that info?

@senadir senadir force-pushed the add/move-woo-event-tracking-frontend branch from 318f2a8 to 5a8ca44 Compare February 9, 2024 13:15
Base automatically changed from add/move-woo-event-tracking-frontend to trunk February 9, 2024 13:26
@jeherve jeherve added [Status] In Progress and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels Feb 21, 2024
@senadir senadir force-pushed the add/custom-fields-tracking branch from 03b7536 to 02e09e0 Compare February 29, 2024 15:12
@senadir senadir requested a review from opr February 29, 2024 16:51
opr
opr previously approved these changes Mar 5, 2024
Copy link
Contributor

@opr opr left a comment

Choose a reason for hiding this comment

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

Works Ok for me, I would recommend updating the testing instructions on this PR so you're not asking to check the filled values are visible (we removed them)

@senadir senadir force-pushed the add/custom-fields-tracking branch from fe334f0 to 916d59e Compare March 15, 2024 17:03
@senadir senadir enabled auto-merge (squash) March 15, 2024 17:04
@github-actions github-actions bot added the [Package] WooCommerce Analytics Enhanced analytics for WooCommerce users label Mar 15, 2024
@senadir senadir requested a review from opr March 15, 2024 17:35
Copy link
Contributor

This PR has been marked as stale. This happened because:

  • It has been inactive for the past 3 months.
  • It hasn’t been labeled `[Pri] BLOCKER`, `[Pri] High`, etc.

If this PR is still useful, please do a [trunk merge or rebase](https://github.com/Automattic/jetpack/blob/trunk/docs/git-workflow.md#keeping-your-branch-up-to-date) and otherwise make sure it's up to date and has clear testing instructions. You may also want to ping possible reviewers in case they've forgotten about it. Please close this PR if you think it's not valid anymore — if you do, please add a brief explanation.

If the PR is not updated (or at least commented on) in another month, it will be automatically closed.

Copy link
Contributor

This PR has been automatically closed as it has not been updated in some time. If you want to resume work on the PR, feel free to restore the branch and reopen the PR.

@github-actions github-actions bot closed this Jul 15, 2024
auto-merge was automatically disabled July 15, 2024 00:49

Pull request was closed

@github-actions github-actions bot deleted the add/custom-fields-tracking branch July 15, 2024 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] WooCommerce Analytics [Package] Tracking This package no longer exists in the monorepo. It was merged into [Package] Connection. [Package] WooCommerce Analytics Enhanced analytics for WooCommerce users [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Status] In Progress [Status] Stale [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants