Skip to content
This repository was archived by the owner on Aug 3, 2025. It is now read-only.
This repository was archived by the owner on Aug 3, 2025. It is now read-only.

Warning: Encountered two children with the same key when enabled alongside Vercel Analytics #400

Description

@jinsley8

I just installed this package in my project, however, if Vercel Analytics is also installed I get the following browser console warning:

Warning: Encountered two children with the same key, ``. Keys should be unique so that components maintain their identity across updates. Non-unique keys may cause children to be duplicated and/or omitted — the behavior is unsupported and could change in a future version.

If I add a key to <GoogleAnalytics /> the warning goes away. Not sure if it was something you needed to be aware of.

import { GoogleAnalytics, event } from 'nextjs-google-analytics';
import { Analytics } from '@vercel/analytics/react';

function MyApp({ Component, pageProps }: AppProps) {
    return (
        <>
             <GoogleAnalytics
                trackPageViews={{ ignoreHashChange: true }}
               key={0}
             />
             <Component {...pageProps} key={router.asPath} />
             <Analytics />
    );
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions