-
Notifications
You must be signed in to change notification settings - Fork 236
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
WORLDSERVICE-486: Use viewability model for component tracking on TEST #12648
Conversation
…' of github.com:bbc/simorgh into WORLDSERVICE-486-use-viewability-for-component-tracking
// 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`); | ||
}); |
There was a problem hiding this comment.
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.
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
Thanks for the feedback @karinathomasbbc |
There was a problem hiding this 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
Co-authored-by: Karina Thomas <58214768+karinathomasbbc@users.noreply.github.com>
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
Developer Checklist
Testing
Ready-For-Test, Local
)Ready-For-Test, Test
)Ready-For-Test, Preview
)Ready-For-Test, Live
)Additional Testing Steps
Useful Links