Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Third parties] Google analytics Add debug mode #63405

Merged
merged 6 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/third-parties/src/google/ga.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ declare global {
let currDataLayerName: string | undefined = undefined

export function GoogleAnalytics(props: GAParams) {
const { gaId, dataLayerName = 'dataLayer', nonce } = props
const { gaId, debugMode, dataLayerName = 'dataLayer', nonce } = props

if (currDataLayerName === undefined) {
currDataLayerName = dataLayerName
Expand Down Expand Up @@ -43,7 +43,7 @@ export function GoogleAnalytics(props: GAParams) {
function gtag(){window['${dataLayerName}'].push(arguments);}
gtag('js', new Date());

gtag('config', '${gaId}');`,
gtag('config', '${gaId}' ${debugMode ? ",{ 'debug_mode': true }" : ''});`,
}}
nonce={nonce}
/>
Expand Down
1 change: 1 addition & 0 deletions packages/third-parties/src/types/google.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export type GTMParams = {
export type GAParams = {
gaId: string
dataLayerName?: string
debugMode?: boolean
nonce?: string
}

Expand Down
Loading