Skip to content

Commit

Permalink
Make selectors for event triggers more robust
Browse files Browse the repository at this point in the history
  • Loading branch information
hotinglok committed Oct 22, 2024
1 parent a7cd6af commit 6905317
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,14 @@ describe('AMP top stories experiment', () => {
"trackTopStoriesClick": {
"on": "click",
"request": "topStoriesClick",
"selector": "[data-testid='promo-link']",
"selector": "a[aria-labelledby*='top-stories-promo']",
},
"trackTopStoriesView": {
"on": "visible",
"request": "topStoriesView",
"visibilitySpec": {
"continuousTimeMin": 200,
"selector": "[class*='experimentTopStoriesSection']",
"selector": "section[aria-labelledby='top-stories-heading']",
"totalTimeMin": 500,
"visiblePercentageMin": 20,
},
Expand Down
5 changes: 2 additions & 3 deletions src/app/pages/ArticlePage/experimentTopStories/helpers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export const getExperimentAnalyticsConfig = ({
on: 'visible',
request: 'topStoriesView',
visibilitySpec: {
selector: `[class*='experimentTopStoriesSection']`,
selector: `section[aria-labelledby='top-stories-heading']`,
visiblePercentageMin: 20,
totalTimeMin: 500,
continuousTimeMin: 200,
Expand All @@ -93,7 +93,7 @@ export const getExperimentAnalyticsConfig = ({
trackTopStoriesClick: {
on: 'click',
request: 'topStoriesClick',
selector: `[data-testid='promo-link']`,
selector: `a[aria-labelledby*='top-stories-promo']`,
},
},
};
Expand Down Expand Up @@ -193,7 +193,6 @@ export const ExperimentTopStories = ({
<div
css={styles.experimentTopStoriesSection}
data-testid="experiment-top-stories"
data-vars-top-stories-position="experiment"
>
<TopStoriesSection content={topStoriesContent} />
</div>
Expand Down

0 comments on commit 6905317

Please sign in to comment.