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

Only inject Vercel analytics in production #6258

Merged
merged 2 commits into from
Feb 16, 2023
Merged

Conversation

delucis
Copy link
Member

@delucis delucis commented Feb 15, 2023

Changes

  • Only injects the script for Vercel analytics on build
  • Vercel’s analytics scripts rely on some extra scripts Vercel injects magically to projects built on their platform but these aren’t available locally so 404 (reported in Vercel analytics file missing #6230 along with other stuff)
  • Folks likely don’t want to track analytics locally anyway

Philosophical question: is this difference between dev and build OK? Generally differences between the two can trip people up — what if this script interferes with some other part of the project somehow and you only notice in production?

Testing

Existing tests should pass. Do we want a test that asserts the script is not included in dev?

Docs

No docs needed I don’t think.

@changeset-bot
Copy link

changeset-bot bot commented Feb 15, 2023

🦋 Changeset detected

Latest commit: 5df4330

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 Feb 15, 2023
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 think it's fine for the dev and build to work differently, especially that analytics should be "addons" that a site can work with or without at a time.

It also looks like Vercel analytics doesn't have an API for tracking custom events, so the changes is safer too.

@natemoo-re natemoo-re merged commit 0fe74b6 into main Feb 16, 2023
@natemoo-re natemoo-re deleted the chris/vercel-analytics branch February 16, 2023 15:19
@astrobot-houston astrobot-houston mentioned this pull request Feb 16, 2023
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.

3 participants