How to track custom events when Google Analytics is managed by Google Tag Manager?

前端 未结 2 665
灰色年华
灰色年华 2020-12-31 17:43

I ended up having to use Google Tag Manager for my site, so Google Analytics is now a part of that. It\'s all set up correctly and working fine. However, I used to be able t

2条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-31 17:55

    I created a new "custom html" tag in Tag Manager. Then I added the analytics.js code below and set the tag to fire on page load. This allowed me to use the existing ga calls in my code to fire custom events rather than re-writing all of my events to work with Universal Analytics through the dataLayer as the other answer suggested.

    
    
    
    
    

提交回复
热议问题