Skip to content

theabhinavdas/ga-react

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

35 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ga-react

A simple script to integrate Google Analytics into React Starter Kit projects.

Getting Started

Installing

Install package by running

npm install ga-react --save

OR

yarn add ga-react

Usage in class component

const tawkTo = require("tawkto-react");

// note this is not just property id, but the string after the slash (/) as well
const tawkToPropertyId = 'get_property_id_from_tawkto_dashboard'

componentDidMount(){
    tawkTo(tawkToPropertyId)
}

Usage in functional component

const tawkTo = require("tawkto-react");

const tawkToPropertyId = 'get_property_id_from_tawkto_dashboard'

useEffect(() => {
    tawkTo(tawkToPropertyId)
}, [])

Function must be called after the DOM is loaded, such as inside componentDidMount or useEffect.

Authors

  • Abhinav Das

About

Google Analytics for React Starter Kit

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •