rsnext/test/e2e/third-parties/pages/ga.js
Janicklas Ralph ce92cea18d
Adding Google analytics to next/third-parties (#58418)
Co-authored-by: Jiachi Liu <inbox@huozhi.im>
2023-12-11 18:21:32 +00:00

21 lines
462 B
JavaScript

import React from 'react'
import { GoogleAnalytics, sendGAEvent } from '@next/third-parties/google'
const Page = () => {
const onClick = () => {
sendGAEvent({ event: 'buttonClicked', value: 'xyz' })
}
return (
<div class="container">
<GoogleAnalytics gaId="GA-XYZ" />
<h1>GA</h1>
<button id="ga-send" onClick={onClick}>
Click
</button>
<GoogleAnalytics gaId="GA-XYZ" />
</div>
)
}
export default Page