Ensure we don't skip tracking when Yoast updates meta#365
Merged
Conversation
… if that is set and the Yoast primary category isn't
jeffpaul
previously approved these changes
Nov 10, 2022
Contributor
jeffpaul
left a comment
There was a problem hiding this comment.
wonderful, many thanks!
|
Kudos, SonarCloud Quality Gate passed!
|
Contributor
|
@dkotter 3 PHPCS warnings cropped up in that file... can you take a quick look to see if the related code should have an |
Contributor
|
Lol your commit to fix those came in as I was writing that comment, ++karma |
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
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.








Description of the Change
If using Yoast, the primary category data is saved by making a second request whenever content is saved. In #335, functionality was added to skip duplicate tracking events. But this also skips those updates from Yoast which now means you don't accurately track category information (unless you save twice).
This PR modifies the functionality introduced in #335 slightly so instead of always skipping tracking during those second requests, we only skip those if the primary category data isn't being saved.
Note: this does mean for those using Yoast, two tracking requests will be sent to Sophi each time content is saved. May be worth finding a better solution for this in the future.
Also note: there may come a time in the future where some other data is needed that is saved the same way (using the legacy meta box feature). The code change here only allows the Yoast primary category data to trigger a duplicate tracking event. Just something to hopefully remember in case this comes up again.
Alternate Designs
Could refactor how we send tracking events to wait until all data has been saved before we send a tracking event. This would remove all chance of duplicates but it is more effort and only solves this single use case at the moment.
Possible Drawbacks
For those using Yoast, duplicate tracking events will be sent
Verification Process
Test with both Yoast active and not active, adding and removing categories and ensuring those are tracked correctly.
Checklist:
Changelog Entry
Credits
Props @dkotter