Non-Partisan Magicians

    @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.

    Install

    npm i @ta-interaktiv/react-gtm

    DownloadsWeekly Downloads

    84

    Version

    6.0.1

    License

    ISC

    Unpacked Size

    28.7 kB

    Total Files

    13

    Last publish

    Collaborators

    • dariush-mehdiaraghi
    • mrdz_tx
    • mathiaslutz
    • bartfehr
    • sebaa
    • grmnd