Skip to content

Instantly share code, notes, and snippets.

@jimkeller
Created July 18, 2024 15:16
Show Gist options
  • Save jimkeller/b67a36bf979e281b513d218c4ddef025 to your computer and use it in GitHub Desktop.
Save jimkeller/b67a36bf979e281b513d218c4ddef025 to your computer and use it in GitHub Desktop.
Next.js Google Analytics module multiple streams bug
import React from "react";
import { GoogleAnalytics } from '@next/third-parties/google';
export default async function RootLayout({
children,
params,
}) {
return (
<html lang='en'>
<body>
{children}
</body>
{/* The first included stream works as expected */}
<GoogleAnalytics gaId="G-1234567" />
{/* The gtag/js script will be added for this stream, but gtag('config') is not called */}
<GoogleAnalytics gaId="G-8910112" />
</html>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment