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

WSTEAM1-1549: Adds click view tracking to Live Header Media #12276

Merged
merged 10 commits into from
Jan 17, 2025

Conversation

Isabella-Mitchell
Copy link
Contributor

@Isabella-Mitchell Isabella-Mitchell commented Jan 15, 2025

Resolves JIRA WSTEAM1-1549

Overall changes

Adds click and view tracking to Live Header Media 'Watch now CTA'

Code changes

  • Uses hooks to apply click and view tracking to component
  • Adds unit tests

Expected behaviour:

  • View Event - (first view, subsequent clicks will not be tracked)
  • Click Event - (first click, subsequent clicks will not be tracked)

Testing

  • Run locally and visit http://localhost.bbc.com:7081/mundo/live/c7dkx155e626t or visit on preview or test
  • Open dev tools > network tab.
  • View the component. You should see a request which includes this value: ati: PUB-[live-page]-[live-header-media]-[]-[]-[live_coverage.c7dkx155e626t.page]-[]-[]-[]
  • Click on the component. You should see a request which includes this value: atc: PUB-[live-page]-[live-header-media]-[]-[]-[live_coverage.c7dkx155e626t.page]-[]-[]-[]
  • See the ticket for more information on events in Piano.

Helpful Links

Add Links to useful resources related to this PR if applicable.

Coding Standards

Repository use guidelines

@Isabella-Mitchell Isabella-Mitchell marked this pull request as ready for review January 15, 2025 14:23
@Isabella-Mitchell Isabella-Mitchell changed the title WSTEAM1-1549: Adds click view tracking WSTEAM1-1549: Adds click view tracking to Live Header Media Jan 15, 2025
);
const playCloseButton = screen.getByTestId('watch-now-close-button');
fireEvent.click(playCloseButton);
expect(clickTrackerSpy).toHaveBeenCalledWith(undefined);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this expected? Or do we expect the click tracker spy not to have been called at all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good point. For the tests I copied the logic used in src/app/components/Billboard/index.test.tsx.

Since we're no longer passing in eventTrackingData in as a prop, we expect the click/ view trackers to always be called, so I suppose I can remove these tests.

All that said... I had a bit of trouble with these tests. If I follow the pattern here and call .mockImplementation(); then I get error Error: Uncaught [TypeError: clickTrackerHandler is not a function]. I haven't been able to work out why.

src/app/components/LiveHeaderMedia/index.test.tsx Outdated Show resolved Hide resolved
ws-nextjs-app/pages/[service]/live/[id]/Header/index.tsx Outdated Show resolved Hide resolved
@Isabella-Mitchell Isabella-Mitchell merged commit d388ff8 into latest Jan 17, 2025
11 checks passed
@Isabella-Mitchell Isabella-Mitchell deleted the WSTEAM1-1549-live-media-tracking-new branch January 17, 2025 14:11
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