I'm trying to transition a NextJS app to GA4.
Initial page loads send events as expected, but subsequent pages (visited by clicking a link generated by the Next’s Link component) will log pageview events twice. Other events fire once, as expected.
In other words, if I go to Page A, then click a link to Page B, Page A the realtime events will show one visit to Page A but two visits to Page B.
Can't tell if this is a GA4 bug, a NextJS bug, or a problem with my implementation.
This behavior is not observed in our traditional GA setup, and it is observed even when stripping all of the existing GA analytics (employed via React-GA), and it is observed in and out of dev mode.
The GA4 tag is loaded on each page by including the following in a common component:
<script async src="https://www.googletagmanager.com/gtag/js?id=G-xxxxxxxx" />
<script
type="text/javascript"
dangerouslySetInnerHTML={{
__html: `window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-xxxxxxxx');`,
}}
/>

