As more and more people visited my blog, I reached the limit of data ingestion of at the end of August.
In order to continue supervising the web traffic of my blog, I decided to replace Vercel Analytics
with Google Analytics
.
Firstly, I need a new account of google analytics. I had one, so I just need create an new id
or use the id
I created before.
For those who do not have google analytics account yet, you can read these toturials,
Google Analytics for Beginners
For decoupling the Google Analytics ID with JSX page in Next.js, I set NEXT_PUBLIC_ANALYTICS_ID
as environment variable in .env.development
file
and copy MEASUREMENT ID
into it.
And substitute Vercel Analytics
with a code snippets from View tag instructions
as below:
Viewing page source and see:
Setting the environment variable, NEXT_PUBLIC_ANALYTICS_ID
with MEASUREMENT ID
, in production,
which will automatically inject MEASUREMENT ID
in the rigit position of the page
after pushing source code to GitHub repository, https://github.com/shenlu.me.
Success!