简体   繁体   中英

Google Analytics Click to Call event to AMP

I'm using native mode

How can I change the code below to the AMP version?

onclick="gtag('event','Click to call',{'event_category':'Call tracking','event_label':'Mobile header'});"
  <script type="application/json">
    {
      "vars": {
        "gtag_id": "<GA_TRACKING_ID>",
        "config": {
          "<GA_TRACKING_ID>": {}
        }
      },
      "triggers": {
        "button": {
          "selector": "#the-button",
          "on": "click",
          "vars": {
            "event_name": "login",
            "method": "Google",
            "event_category": "Call tracking",
            "event_label": "Mobile header"
          }
        }
      }
    }
  </script>

Documentation: https://developers.google.com/analytics/devguides/collection/amp-analytics/#complete_example

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM