0.0.1 • Published 9 years ago

@info.nl/react-google-tagmanager v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
9 years ago

react-google-tagmanager npm version

Google Tag Manager code strings for React server page templates.

Installation

$ npm i @info.nl/react-google-tagmanager -S

Usage

import reactGoogleTagmanager from "react-google-tagmanager";

class Html extends Component {
  render() {
    const tagmanager = reactGoogleTagmanager(
      process.env.GOOGLE_TAGMANAGER_ID, 
      'myLayer'
    );

    return (
      <html>
        ...
        <body>
          <noscript
            dangerouslySetInnerHTML={{__html: tagmanager.noscript}}
            ></noscript>
          <script
            dangerouslySetInnerHTML={{__html: tagmanager.script}}
            ></script>
          ...
        </body>
      </html>
    )
  }
}

License

MIT