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

Add web vitals monitoring and integrate with GA4 #33277

Merged
merged 8 commits into from
Dec 4, 2024

Conversation

acrollet
Copy link
Contributor

@acrollet acrollet commented Nov 29, 2024

Are you removing, renaming or moving a folder in this PR?

  • No, I'm not changing any folders (skip to TeamSites and delete the rest of this section)
  • Yes, I'm removing, renaming or moving a folder

⚠️ TeamSites ⚠️

Examples of a TeamSite: https://va.gov/health and https://benefits.va.gov/benefits/. This scenario is also referred to as the "injected" header and footer. You can reach out in the #sitewide-public-websites Slack channel for questions.

Did you change site-wide styles, platform utilities or other infrastructure?

Summary

This PR adds performance reporting in service of 2025 OKR 1.2:

We have reduced the total time Veterans spend waiting for a response from our digital experiences by 50%, towards a goal of less than 4 seconds per transaction.

It uses the web-vitals library to report the core web vitals + TTFB to GA4. This will allow us to view these metrics per app, as our end users experience them. The library is extremely light-weight and should not impact performance itself, as it uses the same mechanism we already use to record analytics events.

The key metric will be LCP, used as a proxy for perceived page load time. TTFB should additionally be useful to help inform how load performance varies with geography.

Testing done

Event collection was verified using the Adswerve extension on a review instance:

image
image

Because analytics are not reported from review instances, the next step will be to verify reporting and data shape in the staging environment.

What areas of the site does it impact?

All apps.

Acceptance criteria

Quality Assurance & Testing

  • I fixed|updated|added unit tests and integration tests for each feature (if applicable).
  • No sensitive information (i.e. PII/credentials/internal URLs/etc.) is captured in logging, hardcoded, or specs
  • Linting warnings have been addressed

Error Handling

  • Browser console contains no warnings or errors.
  • Events are being sent to the appropriate logging solution
  • Feature/bug has a monitor built into Datadog or Grafana (if applicable)

Authentication

  • Did you login to a local build and verify all authenticated routes work as expected with a test user

@va-vfs-bot va-vfs-bot temporarily deployed to master/feature/web-vitals-reporting/main November 29, 2024 21:35 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to master/feature/web-vitals-reporting/main November 29, 2024 23:27 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to master/feature/web-vitals-reporting/main December 2, 2024 22:04 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to master/feature/web-vitals-reporting/main December 3, 2024 16:43 Inactive
Copy link

@va-vfs-bot va-vfs-bot left a comment

Choose a reason for hiding this comment

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

ESLint is disabled

vets-website uses ESLint to help enforce code quality. In most situations we would like ESLint to remain enabled.

What you can do

See if the code can be refactored to avoid disabling ESLint, or wait for a VSP review.

@acrollet acrollet merged commit a1376d9 into main Dec 4, 2024
87 of 89 checks passed
@acrollet acrollet deleted the feature/web-vitals-reporting branch December 4, 2024 15:11
Thrillberg pushed a commit that referenced this pull request Dec 9, 2024
* Add web vitals monitoring and integrate with GA4

* de-duplicate internal-slot package

* de-duplicate internal-slot package

* Update event name to meet gtm reqs

* Exclude production envs to allow testing in staging

* Add unit tests
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.

4 participants