-
Notifications
You must be signed in to change notification settings - Fork 72
Respect merchant tracking preferences for shopper events #11188
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
Open
rtio
wants to merge
10
commits into
develop
Choose a base branch
from
woopmnt-4451-update-shopper-tracks-events-enablement-criteria
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Respect merchant tracking preferences for shopper events #11188
rtio
wants to merge
10
commits into
develop
from
woopmnt-4451-update-shopper-tracks-events-enablement-criteria
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Add wcpay_enable_shopper_tracking filter for global control - Respect WooCommerce global tracking opt-out setting - Add unit tests for both features Fixes WOOPMNT-4451 (Phase 1)
Contributor
Test the buildOption 1. Jetpack Beta
Option 2. Jurassic Ninja - available for logged-in A12s🚀 Launch a JN site with this branch 🚀 ℹ️ Install this Tampermonkey script to get more options. Build info:
Note: the build is updated when a new commit is pushed to this PR. |
Contributor
|
Size Change: +308 B (0%) Total Size: 927 kB
ℹ️ View Unchanged
|
6 tasks
Client-side optimization to prevent unnecessary requests: - Pass enableShopperTracking flag from PHP to JavaScript - Add check in recordUserEvent() before sending Ajax requests - Respects both wcpay_enable_shopper_tracking filter and woocommerce_allow_tracking option - Added to both wcpayConfig and express checkout config Benefits: - Prevents unnecessary network requests when tracking is disabled - Reduces server processing for requests that would be rejected - Improves performance for merchants who opt out of tracking - Server-side validation remains as defense in depth No functional changes - server-side checks from previous commit remain This is purely a client-side performance optimization
…onfig Changes enable_shopper_tracking to use snake_case in the express checkout handler to match the naming convention of other attributes like ajax_url and wc_ajax_url. The regular checkout config keeps camelCase (enableShopperTracking) as it follows that convention consistently. Updated client/tracks/index.ts to read the correct property name from each config.
…-enablement-criteria
- Add wcpay_tracker_is_admin_page filter to allow tests to bypass admin check - Set up test environment with US store country in setUp() - Fix test_does_track_non_admins to properly create users instead of setting roles - Update all new tests to pass track_on_all_stores=true to bypass WooPay check - Add non-admin users to tracking tests Note: 2 tests still failing and need further debugging: - test_does_track_non_admins - test_respects_wcpay_enable_shopper_tracking_filter
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #9677
See WOOPMNT-4451
Changes proposed in this Pull Request
This PR addresses the issue where WooCommerce Payments shopper tracking events ignore the merchant's tracking preferences.
What am I missing?
Testing instructions
Test 1: Respect WooCommerce global opt-out
/wp-admin/admin-ajax.php. In browser network tab, check the payload and look foraction platform_tracksTest 2: Respect wcpay_enable_shopper_tracking filter
Test 3: Filter takes priority
add_filter( 'wcpay_enable_shopper_tracking', '__return_false' );npm run changelogto add a changelog file, choosepatchto leave it empty if the change is not significant. You can add multiple changelog files in one PR by running this command a few times.Post merge