Unverified Commit 0df6fc90 authored by Houssein Djirdeh's avatar Houssein Djirdeh Committed by GitHub

[Docs] Clarify measurement ID in `Optimizing: Third Party Libraries` (#60136)

Minor changes to `Optimizing: Third Party Libraries` doc page to clarify
which type of ID for Google Analytics (and GTM)
parent 65d59a24
...@@ -35,7 +35,8 @@ page. By default, it fetches the original inline script after hydration occurs o ...@@ -35,7 +35,8 @@ page. By default, it fetches the original inline script after hydration occurs o
<AppOnly> <AppOnly>
To load Google Tag Manager for all routes, include the component directly in your root layout: To load Google Tag Manager for all routes, include the component directly in your root layout and
pass in your GTM container ID:
```tsx filename="app/layout.tsx" switcher ```tsx filename="app/layout.tsx" switcher
import { GoogleTagManager } from '@next/third-parties/google' import { GoogleTagManager } from '@next/third-parties/google'
...@@ -71,7 +72,8 @@ export default function RootLayout({ children }) { ...@@ -71,7 +72,8 @@ export default function RootLayout({ children }) {
<PagesOnly> <PagesOnly>
To load Google Tag Manager for all routes, include the component directly in your custom `_app`: To load Google Tag Manager for all routes, include the component directly in your custom `_app` and
pass in your GTM container ID:
```jsx filename="pages/_app.js" ```jsx filename="pages/_app.js"
import { GoogleTagManager } from '@next/third-parties/google' import { GoogleTagManager } from '@next/third-parties/google'
...@@ -173,7 +175,7 @@ docs](https://developers.google.com/tag-platform/tag-manager/datalayer). ...@@ -173,7 +175,7 @@ docs](https://developers.google.com/tag-platform/tag-manager/datalayer).
| Name | Type | Description | | Name | Type | Description |
| --------------- | -------- | ------------------------------------------------------------------------------- | | --------------- | -------- | ------------------------------------------------------------------------------- |
| `gtmId` | Required | Your GTM container id. | | `gtmId` | Required | Your GTM container ID. Usually starts with `GTM-`. |
| `dataLayer` | Optional | Data layer array to instantiate the container with. Defaults to an empty array. | | `dataLayer` | Optional | Data layer array to instantiate the container with. Defaults to an empty array. |
| `dataLayerName` | Optional | Name of the data layer. Defaults to `dataLayer`. | | `dataLayerName` | Optional | Name of the data layer. Defaults to `dataLayer`. |
| `auth` | Optional | Value of authentication parameter (`gtm_auth`) for environment snippets. | | `auth` | Optional | Value of authentication parameter (`gtm_auth`) for environment snippets. |
...@@ -193,7 +195,8 @@ The `GoogleAnalytics` component can be used to include [Google Analytics ...@@ -193,7 +195,8 @@ The `GoogleAnalytics` component can be used to include [Google Analytics
<AppOnly> <AppOnly>
To load Google Analytics for all routes, include the component directly in your root layout: To load Google Analytics for all routes, include the component directly in your root layout and pass
in your measurement ID:
```tsx filename="app/layout.tsx" switcher ```tsx filename="app/layout.tsx" switcher
import { GoogleAnalytics } from '@next/third-parties/google' import { GoogleAnalytics } from '@next/third-parties/google'
...@@ -206,7 +209,7 @@ export default function RootLayout({ ...@@ -206,7 +209,7 @@ export default function RootLayout({
return ( return (
<html lang="en"> <html lang="en">
<body>{children}</body> <body>{children}</body>
<GoogleAnalytics gaId="GA-XYZ" /> <GoogleAnalytics gaId="G-XYZ" />
</html> </html>
) )
} }
...@@ -219,7 +222,7 @@ export default function RootLayout({ children }) { ...@@ -219,7 +222,7 @@ export default function RootLayout({ children }) {
return ( return (
<html lang="en"> <html lang="en">
<body>{children}</body> <body>{children}</body>
<GoogleAnalytics gaId="GA-XYZ" /> <GoogleAnalytics gaId="G-XYZ" />
</html> </html>
) )
} }
...@@ -229,7 +232,8 @@ export default function RootLayout({ children }) { ...@@ -229,7 +232,8 @@ export default function RootLayout({ children }) {
<PagesOnly> <PagesOnly>
To load Google Analytics for all routes, include the component directly in your custom `_app`: To load Google Analytics for all routes, include the component directly in your custom `_app` and
pass in your measurement ID:
```jsx filename="pages/_app.js" ```jsx filename="pages/_app.js"
import { GoogleAnalytics } from '@next/third-parties/google' import { GoogleAnalytics } from '@next/third-parties/google'
...@@ -238,7 +242,7 @@ export default function MyApp({ Component, pageProps }) { ...@@ -238,7 +242,7 @@ export default function MyApp({ Component, pageProps }) {
return ( return (
<> <>
<Component {...pageProps} /> <Component {...pageProps} />
<GoogleAnalytics gaId="GA-XYZ" /> <GoogleAnalytics gaId="G-XYZ" />
</> </>
) )
} }
...@@ -254,7 +258,7 @@ To load Google Analytics for a single route, include the component in your page ...@@ -254,7 +258,7 @@ To load Google Analytics for a single route, include the component in your page
import { GoogleAnalytics } from '@next/third-parties/google' import { GoogleAnalytics } from '@next/third-parties/google'
export default function Page() { export default function Page() {
return <GoogleAnalytics gaId="GA-XYZ" /> return <GoogleAnalytics gaId="G-XYZ" />
} }
``` ```
...@@ -266,7 +270,7 @@ export default function Page() { ...@@ -266,7 +270,7 @@ export default function Page() {
import { GoogleAnalytics } from '@next/third-parties/google' import { GoogleAnalytics } from '@next/third-parties/google'
export default function Page() { export default function Page() {
return <GoogleAnalytics gaId="GA-XYZ" /> return <GoogleAnalytics gaId="G-XYZ" />
} }
``` ```
...@@ -328,10 +332,10 @@ more about event parameters. ...@@ -328,10 +332,10 @@ more about event parameters.
Options to pass to the `<GoogleAnalytics>` component. Options to pass to the `<GoogleAnalytics>` component.
| Name | Type | Description | | Name | Type | Description |
| --------------- | -------- | ------------------------------------------------ | | --------------- | -------- | ------------------------------------------------------------------------------------------------------ |
| `gaId` | Required | Your Google tag id. | | `gaId` | Required | Your [measurement ID](https://support.google.com/analytics/answer/12270356). Usually starts with `G-`. |
| `dataLayerName` | Optional | Name of the data layer. Defaults to `dataLayer`. | | `dataLayerName` | Optional | Name of the data layer. Defaults to `dataLayer`. |
### Google Maps Embed ### Google Maps Embed
......
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