Unverified Commit 6284d41f authored by suu3's avatar suu3 Committed by GitHub

examples: replaced GTM component with GA in Google Analytics example (#73597)

### What?
Replaced the `GoogleTagManager` component with `GoogleAnalytics` in the
`with-google-analytics` example.

### Why?
The current implementation does not align with the
[docs](https://nextjs.org/docs/app/building-your-application/optimizing/third-party-libraries#google-analytics),
and a separate GTM example already exists.

### How?
Replaced the `GoogleTagManager` component with `GoogleAnalytics`.
Co-authored-by: 's avatarSam Ko <sam@vercel.com>
parent 467226c9
import { GoogleTagManager } from "@next/third-parties/google"; import { GoogleAnalytics } from "@next/third-parties/google";
export const metadata = { export const metadata = {
title: "Google Analytics Next.js", title: "Google Analytics Next.js",
...@@ -13,7 +13,7 @@ export default function RootLayout({ ...@@ -13,7 +13,7 @@ export default function RootLayout({
}) { }) {
return ( return (
<html lang="en"> <html lang="en">
<GoogleTagManager gtmId={process.env.NEXT_PUBLIC_GA_ID as string} /> <GoogleAnalytics gaId={process.env.NEXT_PUBLIC_GA_ID as string} />
<body>{children}</body> <body>{children}</body>
</html> </html>
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment