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

Inject analytics env #6876

Merged
merged 8 commits into from
May 15, 2023
Merged

Inject analytics env #6876

merged 8 commits into from
May 15, 2023

Conversation

nblackburn
Copy link
Contributor

@nblackburn nblackburn commented Apr 19, 2023

⚠️ PLEASE REVIEW CAREFULLY BEFORE MERGING IN

Changes

  • add utility for exposing env to vite
  • inject analytics code in serverless adapter
  • inject analytics code in edge adapter
  • inject analytics code in static adapter
  • Added changeset

Testing

  • Ran unit tests
  • Built locally with env present to verify output

Docs

  • No doc changes needed, it is handled internally
  • Mean previous workarounds like vite.define are no longer needed.

Related: #6776 #6751

@changeset-bot
Copy link

changeset-bot bot commented Apr 19, 2023

🦋 Changeset detected

Latest commit: e20edbc

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

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

@github-actions github-actions bot added the pkg: integration Related to any renderer integration (scope) label Apr 19, 2023
@bluwy
Copy link
Member

bluwy commented Apr 20, 2023

Is this needed given #6776 (comment)?

@nblackburn
Copy link
Contributor Author

nblackburn commented Apr 20, 2023

@bluwy I don't believe the analytics ID is included in those. I had to put a workaround in place to get it working.

@bluwy bluwy linked an issue May 10, 2023 that may be closed by this pull request
1 task
@bluwy
Copy link
Member

bluwy commented May 10, 2023

Sorry for not following up on this. Given Vercel doesn't have special PUBLIC_ prefix for VERCEL_ANALYTICS_ID, I'm fine with this workaround for now. It would be nice to add a comment about this too.

This should be good to merge once the conflicts are resolved. Thanks for fixing this!

Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

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

I've rebased the branch. Will merge when CI passes

@bluwy bluwy merged commit 06ca370 into withastro:main May 15, 2023
@astrobot-houston astrobot-houston mentioned this pull request May 15, 2023
@nblackburn nblackburn deleted the inject-analytics-env branch May 15, 2023 12:04
@bluwy bluwy mentioned this pull request Jul 5, 2023
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: integration Related to any renderer integration (scope)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Vercel Analytics Speed Insights errors due to missing env var
2 participants