@ta-interaktiv/react-gtm
TypeScript icon, indicating that this package has built-in type declarations

6.0.1 • Public • Published

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.

npm version

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 ... */}
      />
    )
  }
}

Documentation

Can be found here.

Readme

Keywords

Package Sidebar

Install

npm i @ta-interaktiv/react-gtm

Weekly Downloads

25

Version

6.0.1

License

ISC

Unpacked Size

28.7 kB

Total Files

13

Last publish

Collaborators

  • s1co
  • dariush-mehdiaraghi
  • mrdz_tx
  • mathiaslutz
  • sebaa