Adding Vercel Analytics
Answered
Cordilleran Flycatcher posted this in #help-forum
Cordilleran FlycatcherOP
Hi, I was just wondering where I am supposed to add vercel analytics in this project. https://github.com/movie-web/movie-web
Answered by not-milo.tsx
Since you're not using Next.js it's a little bit different. The component should probably go in your [
Just add it at the end of your jsx block.
Layout.tsx file](https://github.com/movie-web/movie-web/blob/dev/src/setup/Layout.tsx).Just add it at the end of your jsx block.
82 Replies
Place the
Analytics component in your root layout as shown here: https://vercel.com/docs/analytics/packageCordilleran FlycatcherOP
I’m not too sure which one my root layout is or if it’s listed there…
Do you know if it would be somewhere here?
https://github.com/movie-web/movie-web/blob/dev/src/setup/App.tsx
https://github.com/movie-web/movie-web/blob/dev/src/setup/App.tsx
Or if maybe it’s somewhere else?
Since you're not using Next.js it's a little bit different. The component should probably go in your [
Just add it at the end of your jsx block.
Layout.tsx file](https://github.com/movie-web/movie-web/blob/dev/src/setup/Layout.tsx).Just add it at the end of your jsx block.
Answer
Cordilleran FlycatcherOP
Just to check, so it would be something like this?
import { ReactNode } from "react";
import { Analytics } from "@vercel/analytics/react";
import { useBannerSize, useBannerStore } from "@/stores/banner";
import { BannerLocation } from "@/stores/banner/BannerLocation";
export function Layout(props: { children: ReactNode }) {
const bannerSize = useBannerSize();
const location = useBannerStore((s) => s.location);
return (
<div>
<div className="fixed inset-x-0 z-[1000]">
<BannerLocation />
</div>
<div
style={{
paddingTop: location === null ? `${bannerSize}px` : "0px",
}}
className="flex min-h-screen flex-col"
>
{props.children}
</div>
<Analytics />
</div>
);
}also would this work for vercel speed insights as well then?
Yes, it works the same way
Cordilleran FlycatcherOP
thanks! Ill try that now
Cordilleran FlycatcherOP
Do you know if i should be worried about this by any chance?
it works nonetheless. Thank you so much!
@Cordilleran Flycatcher Do you know if i should be worried about this by any chance?
Honestly I don't know. It's the first time I see that kind of error with the Analytics package... 

Blue horntail woodwasp
Did you have no issues installing the dependencies @Cordilleran Flycatcher ive been unable to install due to some issue with ESLINT while using a template from vercel?
If possible could you share the steps you took when installing? did you do pnpm install first? the link first? npm install first?
Cordilleran FlycatcherOP
i am not using a template from vercel, so I dont have any pnpm issues atm
Blue horntail woodwasp
ah, fuck me, maybe i just give up on the template then, its been almost a week of constant issues at this point it doesn't seem worth it, thanks.
Cordilleran FlycatcherOP
my code does use pnpm to install from a pnpm lock file. However I dont seem to have any issues
Blue horntail woodwasp
yea when i installed in the nextjs boiler plate its not issues, its when i use the ecommerce template that its just constant issues.
appreciate you
Cordilleran FlycatcherOP
uhh is it something to do with that?
I mean they reference vercel there
Blue horntail woodwasp
No, when i do pnpm install, it installs correctly its when i try to add any other dependency that it breaks
Cordilleran FlycatcherOP
how are you adding the other dependencies?
Blue horntail woodwasp
Cordilleran FlycatcherOP
ah
you have to use
pnpm i @vercel/analyticsBlue horntail woodwasp
i tried that as well and it just refuses the download lmao
Cordilleran FlycatcherOP
o
Blue horntail woodwasp
says that the registry is invalid for me
Cordilleran FlycatcherOP
it says theres progress
does it just cancel out of that after a while then after?
Blue horntail woodwasp
yea
Cordilleran FlycatcherOP
damn
Blue horntail woodwasp
itll give an error in like 2-3 minutes
See
Cordilleran FlycatcherOP
weird
Blue horntail woodwasp
idk , template just isn't worth the headache, ill have to do the integration manually
sorry for hijacking your post u were the only other person asking about analytics and speedinsights and i wanted to see if u had similar issues as me
sorry for hijacking your post u were the only other person asking about analytics and speedinsights and i wanted to see if u had similar issues as meCordilleran FlycatcherOP
o no its completely fine, my issues resolved :)
i mean
the best thing might be to contact vercel
Blue horntail woodwasp
I did and they said and i qoute " Hi Joel,
Thank you. I can confirm I'm able to add the package without any issue, so it's likely this issue is local to your system and unrelated to any code included in the template.
I'll go ahead and mark this case as resolved since this is confirmed to be out of scope, please feel free to get in touch with us again in the future."
Thank you. I can confirm I'm able to add the package without any issue, so it's likely this issue is local to your system and unrelated to any code included in the template.
I'll go ahead and mark this case as resolved since this is confirmed to be out of scope, please feel free to get in touch with us again in the future."
and then closed my ticket 

Cordilleran FlycatcherOP
💀
quality support ðŸ˜
Blue horntail woodwasp
is what it is
Cordilleran FlycatcherOP
try
pnpm upgrade pnpm -gBlue horntail woodwasp
again, sorry for the hijack and ty
@Cordilleran Flycatcher try pnpm upgrade pnpm -g
Blue horntail woodwasp
mk sec
Cordilleran FlycatcherOP
then
pnpm cache clean --force then try the pnpm install command againBlue horntail woodwasp
idk maybe it is something with my pc
Cordilleran FlycatcherOP
weird
can you try
pnpm update -g?or
npm install -g pnpm?Blue horntail woodwasp
pnpm update -g didnt work but npm install -g pnpm did
Cordilleran FlycatcherOP
uhh
Blue horntail woodwasp
shouldn't it be fine since it installed pnpm install just fine?
@Cordilleran Flycatcher then pnpm cache clean --force then try the pnpm install command again
Cordilleran FlycatcherOP
could you try this again now and see if it works
@Blue horntail woodwasp shouldn't it be fine since it installed pnpm install just fine?
Cordilleran FlycatcherOP
yea it should
Blue horntail woodwasp
Cordilleran FlycatcherOP
o
whoops
ok, could you just try installing then|?
Blue horntail woodwasp
just doing pnpm -g uninstall ?
Cordilleran FlycatcherOP
o no the vercel install command with pnpm
Blue horntail woodwasp
oh
got you
Cordilleran FlycatcherOP
if that doesnt work the only thing I can think of is to add it to the pnpm lock file manually like this:
And then install the dependencies again
'@vercel/analytics':
specifier: ^1.2.2
version: 1.2.2(react@18.2.0)And then install the dependencies again
Blue horntail woodwasp
Yea both came back with the same error, its fine ill just make the integration myself somehow , honestly not worth it at this point and its just causing me massive delays to try to figure out simple package issues.
thank you for all your help man for real
Cordilleran FlycatcherOP
ah ok
@Blue horntail woodwasp thank you for all your help man for real
Cordilleran FlycatcherOP
np, sorry I cant solve it...
@Cordilleran Flycatcher np, sorry I cant solve it...
Northeast Congo Lion
Are you able to make the repo public at all. I can clone it and have a look if issues are still persisting. I have used Vercel analytics on few projects
Oh I think it’s joey with the issues, right?
Cordilleran FlycatcherOP
yea
@Blue horntail woodwasp
Blue horntail woodwasp
I cant unfortunately because its linked to my company as of right now, i can create a dummy store tonight and ill create a helpm forum with my issue and tag yall.
