mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
This PR adds the `useGoogleTagManage` hook to `@next/third-parties` repo.
22 lines
473 B
JavaScript
22 lines
473 B
JavaScript
import React from 'react'
|
|
import { GoogleTagManager, sendGTMEvent } from '@next/third-parties/google'
|
|
|
|
const Page = () => {
|
|
const onClick = () => {
|
|
sendGTMEvent({ event: 'buttonClicked', value: 'xyz' })
|
|
}
|
|
|
|
return (
|
|
<div class="container">
|
|
<GoogleTagManager gtmId="GTM-XYZ" />
|
|
<h1>GTM</h1>
|
|
<button id="gtm-send" onClick={onClick}>
|
|
Click
|
|
</button>
|
|
<GoogleTagManager gtmId="GTM-XYZ" />
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default Page
|