8000 WORLDSERVICE-486: Use viewability model for component tracking on TEST by alex-magana · Pull Request #12648 · bbc/simorgh · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

WORLDSERVICE-486: Use viewability model for component tracking on TEST #12648

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

Merged

Conversation

alex-magana
Copy link
Contributor
@alex-magana alex-magana commented Apr 15, 2025

Resolves JIRA: https://jira.dev.bbc.co.uk/browse/WORLDSERVICE-486

Summary

Adopt the viewability model for reporting click and view component events.

Code changes

  • Use the viewability object to report component click and view events.

Developer Checklist

  • UX
    • UX Criteria met (visual UX & screenreader UX)
  • Accessibility
    • Accessibility Acceptance Criteria met
    • Accessibility swarm completed
    • Component Health updated
    • P1 accessibility bugs resolved
    • P2/P3 accessibility bugs planned (if not resolved)
  • Security
    • Security issues addressed
    • Threat Model updated
  • Documentation
    • Docs updated (runbook, READMEs)
  • Testing
    • Feature tested on relevant environments
  • Comms
    • Relevant parties notified of changes

Testing

  • Manual Testing required?
    • Local (Ready-For-Test, Local)
    • Test (Ready-For-Test, Test)
    • Preview (Ready-For-Test, Preview)
    • Live (Ready-For-Test, Live)
  • Manual Testing complete?
    • Local
    • Test
    • Preview
    • Live

Additional Testing Steps

  1. List the steps required to test this PR.

Useful Links

@alex-magana alex-magana marked this pull request as ready for review April 23, 2025 08:51
Comment on lines 96 to 133
// Component Views & Clicks - Viewability Model
Object.values(COMPONENTS).forEach(component => {
const viewEventRegex = new RegExp(
`\\[\\{"name":"viewability\\.view","data":\\{(?:.*)?"event":\\{"category":"viewability","action":"view"\\}(?:.*)?"item":\\{(?:.*)?"name":"${component}(.*)?"(?:.*)?\\}\\}\\}\\]`,
'g',
);

const clickEventRegex = new RegExp(
`\\[\\{"name":"viewability\\.select","data":\\{(?:.*)?"event":\\{"category":"viewability","action":"select"\\}(?:.*)?"item":\\{(?:.*)?"name":"${component}(.*)?"(?:.*)?\\}\\}\\}\\]`,
'g',
);

// Component Views
cy.intercept(
{
url: `${atiUrl}/*`,
query: {
events: viewEventRegex,
},
},
request => {
request.reply({ statusCode: 200 });
},
).as(`${component}-ati-view-viewability`);

// Component Clicks
cy.intercept(
{
url: `${atiUrl}/*`,
query: {
events: clickEventRegex,
},
},
request => {
request.reply({ statusCode: 200 });
},
).as(`${component}-ati-click-viewability`);
});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've duplicated the CPV model logic instead of abstracting the matchers
into a function to retain the verbose nature of the tests.

alex-magana and others added 11 commits April 30, 2025 13:01
Co-authored-by: Karina Thomas <58214768+karinathomasbbc@users.noreply.github.com>
Co-authored-by: Karina Thomas <58214768+karinathomasbbc@users.noreply.github.com>
Co-authored-by: Karina Thomas <58214768+karinathomasbbc@users.noreply.github.com>
Co-authored-by: Karina Thomas <58214768+karinathomasbbc@users.noreply.github.com>
Co-authored-by: Karina Thomas <58214768+karinathomasbbc@users.noreply.github.com>
…' of github.com:bbc/simorgh into WORLDSERVICE-486-use-viewability-for-component-tracking
@alex-magana
Copy link
Contributor Author

Thanks for the feedback @karinathomasbbc
The changes are now in place. Please take a gander when you have a moment.
Thanks. 😄

Copy link
Contributor
@karinathomasbbc karinathomasbbc left a comment

Choose a reason for hiding this comment

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

Lovely stuff, thanks @alex-magana

alex-magana and others added 2 commits April 30, 2025 14:01
Co-authored-by: Karina Thomas <58214768+karinathomasbbc@users.noreply.github.com>
@alex-magana alex-magana merged commit 0772873 into latest Apr 30, 2025
11 checks passed
@alex-magana alex-magana deleted the WORLDSERVICE-486-use-viewability-for-component-tracking branch April 30, 2025 11:33
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.

3 participants
0