@ta-interaktiv/react-gtm
v6.1.1
Published
Component to add Google Tag Manager to projects.
Downloads
56
Readme
Google Tag Manager React Component
Component to use Google Tag Manager on the page. This component should only be mounted when the GMT ID has be defined.
Installation
yarn add @ta-interaktiv/react-gtm
Usage
import React from 'react'
import { GoogleTagManager } from '@ta-interaktiv/react-gtm'
// more code ...
class YourComponent extends React.Component {
componentDidMount() {
// Get the Webseismo statistics object from Newsnet API here
// NOT ACTUAL IMPLEMENTATION!
this.setState({
gtmObject: data.statistics.gtm,
gtmId: data.gtmId
})
}
render() {
return (
<GoogleTagManager
gtmId={this.state.gtmId}
article_id="000"
{/* further properties ... */}
/>
)
}
}