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

Integrate with Vercel Analytics #13

Closed
Atinux opened this issue Nov 5, 2020 · 10 comments
Closed

Integrate with Vercel Analytics #13

Atinux opened this issue Nov 5, 2020 · 10 comments
Labels
enhancement New feature or request

Comments

@Atinux
Copy link
Contributor

Atinux commented Nov 5, 2020

I believe it would be nice to support Vercel analytics since they also use web-vitals for their API.

Vercel did a prototype based on this module actually: https://github.com/vercel/nuxt-plugin-vercel

We could imagine a provider option, default to ga and overwritten with NUXT_VITALS_PROVIDER or directly having NUXT_VITALS_URL?

@Atinux Atinux added the enhancement New feature or request label Nov 5, 2020
@daliborgogic
Copy link
Collaborator

daliborgogic commented Nov 7, 2020

Analytics is currently only available for projects using Next.js and Gatsby.
We need provider option because url and payload data are different between ga and vercel.
First we need to solve how to get access/enable analytics for nuxt project.
Can via this module...

@daliborgogic
Copy link
Collaborator

@daliborgogic
Copy link
Collaborator

Branch providers

@daliborgogic
Copy link
Collaborator

daliborgogic commented Nov 7, 2020

If we use target static and buildModules we dont have during the build process.env.VERCEL_ANALYTICS_ID.
Status 400 Bad request.
Demo: https://nxt-vercel.vercel.app/
Other works as expected. Dinamicaly applied provider based on option trackingID.
Problem is only in VERCEL_ANALYTICS_ID environment variable.

edit: typo

@daliborgogic
Copy link
Collaborator

Screenshot 2020-11-07 at 18 26 07

@pi0
Copy link
Contributor

pi0 commented Nov 9, 2020

Hi :D

Other works as expected. Dinamicaly applied provider based on option trackingID.

I think you can leverage runtimeConfig for this.

@daliborgogic
Copy link
Collaborator

@pi0 I try but during the build on vercel we dont have VERCEL_ANALYTICS_ID environment for some reason...

@daliborgogic
Copy link
Collaborator

I notice for gatsby they have GATSBY_VERCEL_ANALYTICS_ID, then i/we can expect for nuxt to be NUXT_VERCEL_ANALYTICS_ID. For now vercel official have support ONLY for gatsby and for next...

@pi0
Copy link
Contributor

pi0 commented Nov 9, 2020

Hmm interesting 🤔

For Gatsby they alias it here: https://github.com/vercel/vercel/blob/5bea99c1d9817cbfa3983f2386bd3083f5129d73/packages/now-static-build/src/utils/gatsby.ts#L23

For VERCEL_ANALYTICS_ID, let me ask :)

@pi0
Copy link
Contributor

pi0 commented Feb 4, 2021

Module released with vercel support. Waiting for vercel team to make final touches on their side :)

@Atinux Atinux closed this as completed Feb 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants