简体   繁体   中英

Google AMP and Google Analytics

Is this the correct coding to add into my Google AMP article? I tried to submit to Google AMP and there is no error but the article will not come out in the Google Analytics when I browse my article from my handphone.

<amp-analytics type="googleanalytics">
         <script type="application/json">
          {
            "vars": {
            "account": "UA-XXXXXX"
             },
            "triggers": {
            "trackPageview": {
            "on": "visible",
            "request": "pageview",
             "vars": {
               "title" : "GAMP-"+ "Title of my page"
              }
              }
              }
          }
             </script>
       </amp-analytics>

Please refer to documentation available at

Google amp-analytics documentation

You will need to include the script reference in the head of your html document. Your whole amp html page will need to be validated as well. I suggest going through the starting documentation to create your first google-amp validated page and then add the analytics. Find that guide here

Hello World Google-amp

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