Skip to content

Ensure we don't skip tracking when Yoast updates meta#365

Merged
jeffpaul merged 2 commits intodevelopfrom
fix/yoast-tracking
Nov 10, 2022
Merged

Ensure we don't skip tracking when Yoast updates meta#365
jeffpaul merged 2 commits intodevelopfrom
fix/yoast-tracking

Conversation

@dkotter
Copy link
Copy Markdown
Contributor

@dkotter dkotter commented Nov 10, 2022

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:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Changelog Entry

Fixed - Ensure we send tracking events when the Yoast featured category data is saved.

Credits

Props @dkotter

… if that is set and the Yoast primary category isn't
@dkotter dkotter self-assigned this Nov 10, 2022
@jeffpaul jeffpaul added this to the 1.3.1 milestone Nov 10, 2022
@dkotter dkotter requested review from cadic and jeffpaul November 10, 2022 22:02
jeffpaul
jeffpaul previously approved these changes Nov 10, 2022
Copy link
Copy Markdown
Contributor

@jeffpaul jeffpaul left a comment

Choose a reason for hiding this comment

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

wonderful, many thanks!

@sonarqubecloud
Copy link
Copy Markdown

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 2 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@jeffpaul
Copy link
Copy Markdown
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 ignore comment or if we should update to pass that check?

@jeffpaul
Copy link
Copy Markdown
Contributor

Lol your commit to fix those came in as I was writing that comment, ++karma

@jeffpaul jeffpaul merged commit 75759e4 into develop Nov 10, 2022
@jeffpaul jeffpaul deleted the fix/yoast-tracking branch November 10, 2022 22:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants