Search code examples
google-analyticsnext.jsgoogle-tag-manageramp-html

how to track clicks on outbound links on AMP container


I'm trying to create a tag that tracks clicks to external links from some of my pages. In the past I have never had problems in creating them on web container but now I have to create them for amp container and I am having many problems. Is it possible to get help?


Solution

  • You can use data-vars to get variable in GTAG-Manager via AMP like: <a data-vars-youvarname="linkurl" href="linkurl> and in GTAG-manager you can use the custom var {yourvarname}