268dd6e80b
<!-- Thanks for opening a PR! Your contribution is much appreciated. To make sure your PR is handled as smoothly as possible we request that you follow the checklist sections below. Choose the right checklist for the change that you're making: --> ## Documentation / Examples - [x] Make sure the linting passes by running `pnpm build && pnpm lint` - [x] The "examples guidelines" are followed from [our contributing doc](https://github.com/vercel/next.js/blob/canary/contributing/examples/adding-examples.md) First of all thanks for this amazing project and all the help you provide with these examples. It seems there is code duplication in this example. After some tests locally seem to _document.js is not necessary for `gtag` to work properly. |
||
---|---|---|
.. | ||
components | ||
lib | ||
pages | ||
.env.local.example | ||
.gitignore | ||
package.json | ||
README.md |
Example app with analytics
This example shows how to use Next.js along with Google Analytics. A custom _app is used to inject tracking snippet and track pageviews and event.
Deploy your own
Deploy the example using Vercel:
How to use
Execute create-next-app
with npm, Yarn, or pnpm to bootstrap the example:
npx create-next-app --example with-google-analytics with-google-analytics-app
yarn create next-app --example with-google-analytics with-google-analytics-app
pnpm create next-app --example with-google-analytics with-google-analytics-app
Deploy it to the cloud with Vercel (Documentation).