Prevent tracking admins or order multiple times and additional adjustments #365
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.
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 multiplepurchase
events would be triggered which is fixed in 94b4dc7.Additional cleanup:
async_script_loader_tags()
and setstrategy
on the enqueued script 4e8e1acEnable Standard Tracking
Use Enhanced Link Attribution
Anonymize IP addresses
Screenshots:
Detailed test instructions:
fix/tracking-for-purchases-and-admins
WooCommerce > Settings > Integrations > Google Analytics
purchase
event is sentpurchase
event is not sentAdd to Cart Events
andProduct Detail Views
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