How to set up Google Analytics through Google Tag Manager for Next-Js?

后端 未结 6 986
北恋
北恋 2021-02-13 16:24

formerly I was using react-ga npm module to insert google analytics in my next js app. and It was simply like this:

import ReactGA from \'react-ga\'

export cons         


        
6条回答
  •  南笙
    南笙 (楼主)
    2021-02-13 17:00

    Im using react-gtm-module and config in _app.js inside componentDidMount

     componentDidMount() {
        const tagManagerArgs = {
          gtmId = 'GTM-00001'
        }
    
        TagManager.initialize(tagManagerArgs);
      }
    

    this is my solution updated at Feb 11, 2020

提交回复
热议问题