Skip to content

refactor: stream the analytics provider#2637

Merged
chanceaclark merged 1 commit intocanaryfrom
chore/streamable-analytics
Oct 15, 2025
Merged

refactor: stream the analytics provider#2637
chanceaclark merged 1 commit intocanaryfrom
chore/streamable-analytics

Conversation

@chanceaclark
Copy link
Copy Markdown
Contributor

What/Why?

This pull request implements a streamable analytics provider that optimizes the loading of Google Analytics in the root layout. The changes introduce a new StreamableAnalyticsProvider component that leverages the Streamable library to defer the loading of analytics data until after the initial page render.

Key changes:

  • Created StreamableAnalyticsProvider component that wraps analytics initialization in a Streamable
  • Modified root layout to use streamable analytics data instead of blocking on analytics metadata
  • Refactored AnalyticsProvider in the react library to use PropsWithChildren for better type safety
  • Split analytics data fetching from initial layout data to improve page load performance

The motivation behind this change is to prevent analytics metadata from blocking the initial page render, improving Core Web Vitals and overall user experience. Analytics data is now loaded asynchronously after the page is rendered.

Testing

  • Verify that Google Analytics still initializes correctly on pages
  • Check that page load performance is improved (analytics no longer blocks initial render)
  • Test that the analytics provider context is still available to child components
  • Ensure no console errors are thrown during the streamable loading process

Migration

No breaking changes for consumers. The analytics functionality remains the same from an end-user perspective, but now loads asynchronously for better performance.


This pull request description was generated with the assistance of AI. Portions of the code and/or implementation ideas in this PR may also have been created or influenced by AI tools.

@chanceaclark chanceaclark requested a review from a team October 15, 2025 01:54
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Oct 15, 2025

⚠️ No Changeset found

Latest commit: 6517a1c

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@vercel
Copy link
Copy Markdown

vercel Bot commented Oct 15, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
catalyst-b2b Ready Ready Preview Comment Oct 15, 2025 1:59am
catalyst-canary Ready Ready Preview Comment Oct 15, 2025 1:59am
1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
catalyst Ignored Ignored Oct 15, 2025 1:59am

@chanceaclark chanceaclark added this pull request to the merge queue Oct 15, 2025
Merged via the queue into canary with commit 4845d87 Oct 15, 2025
11 checks passed
@chanceaclark chanceaclark deleted the chore/streamable-analytics branch October 15, 2025 18:20
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.

2 participants