1.0.6 • Published 1 year ago

react-google-analytics4 v1.0.6

Weekly downloads
-
License
ISC
Repository
-
Last release
1 year ago

Down and dirty React library to connect to Google Analytics V4

Import functions

import { initGA4, usePageTracking } from 'react-google-analytics4'

Initialize Google Analytics:

Initialize Analytics with this function in index.js

initGA4(document: Document, measurementId: string)

  • document: DOM document (window.document)
  • measurementId: GA4 Measurement ID

GA React Hook

Put this hook at the top-level component and it will send a GA page_view | page_path event for every route change

usePageTracking()

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago