Skip to content

Latest commit

 

History

History
50 lines (32 loc) · 827 Bytes

README.md

File metadata and controls

50 lines (32 loc) · 827 Bytes

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