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

Prevent tracking admins or order multiple times and additional adjustments #365

Merged
merged 8 commits into from
Mar 5, 2024

Conversation

martynmjones
Copy link
Contributor

@martynmjones martynmjones commented Mar 5, 2024

Changes proposed in this Pull Request:

Following on from #322, this PR ensures that no tracking happens if disable_tracking() returns true. Additionally, the new tracking wasn't considering the _ga_tracked meta value for orders meaning if a user was to refresh the thank you page multiple purchase events would be triggered which is fixed in 94b4dc7.

Additional cleanup:

Screenshots:

Screenshot 2024-03-05 at 13 00 08

Detailed test instructions:

  1. Build extension from fix/tracking-for-purchases-and-admins
  2. Go to Tag Assistant and debug site
  3. While logged in as an admin, confirm that no tracking is sent
  4. Logout
  5. Open an incognito window and ensure all options are selected in WooCommerce > Settings > Integrations > Google Analytics
  6. Confirm events are tracked
  7. Place an order and confirm a purchase event is sent
  8. Refresh the thank you page and confirm a second purchase event is not sent
  9. In the incognito window, disable some events like Add to Cart Events and Product Detail Views
  10. In the non-incognito window, confirm that those events are no longer sent

Additional:

I believe we can remove a couple of the other settings but as we're close to release I decided to only remove settings that explicitly state they are not support by GA4. If any other changes are needed that can be addressed post launch.

Changelog entry

Fix - Prevent tracking orders multiple times and additional fixes

@github-actions github-actions bot added changelog: fix Took care of something that wasn't working. type: bug The issue/PR is a confirmed bug. labels Mar 5, 2024
Base automatically changed from update/consent-mode-custom to trunk March 5, 2024 14:48
Copy link
Member

@tomalec tomalec left a comment

Choose a reason for hiding this comment

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

Thank you for fixes and cleanups!
Reviewed the code, tested locally, LGTM :)

The only comment I have is that as we remove ga_standard_tracking_enabled setting from here, we need to accommodate for that change in GLA integration.

@martynmjones
Copy link
Contributor Author

Thank you for fixes and cleanups! Reviewed the code, tested locally, LGTM :)

The only comment I have is that as we remove ga_standard_tracking_enabled setting from here, we need to accommodate for that change in GLA integration.

Thanks @tomalec! The standard tracking reference in GLA is addressed in woocommerce/google-listings-and-ads#2297

@martynmjones martynmjones merged commit 6687c6a into trunk Mar 5, 2024
6 checks passed
@martynmjones martynmjones deleted the fix/tracking-for-purchases-and-admins branch March 5, 2024 16:09
@jorgemd24 jorgemd24 mentioned this pull request Mar 5, 2024
19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
changelog: fix Took care of something that wasn't working. type: bug The issue/PR is a confirmed bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants