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

Update RRM snippet placement logic #9973

Open
1 task
nfmohit opened this issue Jan 5, 2025 · 1 comment
Open
1 task

Update RRM snippet placement logic #9973

nfmohit opened this issue Jan 5, 2025 · 1 comment
Assignees
Labels
P0 High priority Team M Issues for Squad 2 Type: Enhancement Improvement of an existing feature

Comments

@nfmohit
Copy link
Collaborator

nfmohit commented Jan 5, 2025

Feature Description

The Reader Revenue Manager snippet placement logic should be updated to enable conditional and context-aware snippet placement, as follows:

  • If the current screen is a singular post, the following logic will be used in said order:
    • The googlesitekit_rrm_{Publication ID}:productID post meta setting will be checked.
      • If its value is none, no snippet will be added to the post.
      • If its value is anything other than an empty string, the snippet will be added with the value of the post meta setting as the product ID.
    • Otherwise, all taxonomy terms attached to the post will be queried and each attached term will be checked for a googlesitekit_rrm_{Publication ID}:productID term meta setting (if possible, a meta query will be used to query all terms with the meta set). The value for the first found match will be checked.
      • If its value is none, no snippet will be added to the post.
      • If its value is anything other than an empty string, the snippet will be added with the value of the term meta setting as the product ID.
    • Otherwise, the snippetMode module setting will be checked.
      • If it is per_post, no snippet will be added.
      • If it is post_type, it will be checked if the post type of the current post belongs to the postTypes array module setting.
        • If not, no snippet will be added.
        • If yes, the snippet will be added with the value of the productID module setting as the product ID.
      • If it is sitewide, the snippet will be added with the value of the productID module setting as the product ID.
  • If the current screen is not a singular post, the following logic will be used:
    • The snippetMode module setting will be checked.
      • If it is sitewide, the snippet will be added with the value of the productID module setting as the product ID.

If none of the above conditions are met, no snippet will be added.


Do not alter or remove anything below. The following sections will be managed by moderators only.

Acceptance criteria

Implementation Brief

Test Coverage

QA Brief

Changelog entry

@nfmohit nfmohit self-assigned this Jan 5, 2025
@nfmohit nfmohit added P0 High priority Type: Enhancement Improvement of an existing feature Team M Issues for Squad 2 labels Jan 5, 2025
@nfmohit
Copy link
Collaborator Author

nfmohit commented Jan 6, 2025

@aaemnnosttv While brainstorming the ACs for this issue, I realised that I did not consider an edge-case scenario. Suppose, in a certain post, the RRM tag is not added based on the above logic. However, the user has added the inline button block (#9963). Since we're not adding the snippet, the button will not work. Do you have a suggestion on how we can address this edge-case? Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P0 High priority Team M Issues for Squad 2 Type: Enhancement Improvement of an existing feature
Projects
None yet
Development

No branches or pull requests

2 participants