next.js/test/e2e/third-parties/pages/gtm.js
gtm.js22 lines473 B
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
Quest for Codev2.0.0
/
SIGN IN