i started new project including amp.
firefox systematically report error:
typeerror: window.amp undefined
i followed getting started steps. here how head tag of index looks like:
<html amp lang="fr"> <head> <meta charset="utf-8"> <title>my title</title> <link rel="canonical" href="http://example.com/non-amp_index.php" /> <meta http-equiv="x-ua-compatible" content="ie=edge,chrome=1"> <meta name="description" content="description"> <meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"> <meta property="og:url" content="http://example.com/home" /> <meta property="og:type" content="article" /> <meta property="og:title" content="title" /> <meta property="og:description" content="description" /> <meta property="og:image" content="sharedimage" /> <meta name="twitter:card" content="summary_large_image"> <meta name="twitter:site" content="@client"> <meta name="twitter:title" content="title"> <meta name="twitter:description" content="description"> <meta name="twitter:image" content="sharedimage"> <style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style> <noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript> <!-- amp properties --> <script type="application/ld+json"> { "@context": "http://schema.org", "@type": "newsarticle", "mainentityofpage":{ "@type":"webpage", "@id":"http://example.com" }, "headline": "<?=$copydeck['title'] ?>", "image": { "@type": "imageobject", "url": "http://example.com/cover.jpg", "height": 800, "width": 800 }, "datepublished": "2016-09-02t08:00:00+08:00", "datemodified": "2016-09-02t09:20:00+08:00", "author": { "@type": "organization", "name": "client" }, "publisher": { "@type": "organization", "name": "client", "logo": { "@type": "imageobject", "url": "https://example.com/logo.png", "width": 320, "height": 120 } }, "description": "description" } </script> <!-- analytics --> <script> (function(i,s,o,g,r,a,m){i['googleanalyticsobject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new date();a=s.createelement(o), m=s.getelementsbytagname(o)[0];a.async=1;a.src=g;m.parentnode.insertbefore(a,m) })(window,document,'script','https://www.google-analytics.com/analytics.js','ga'); ga('create', 'ua-analytics', 'auto'); ga('send', 'pageview'); </script> <!-- comscore --> <script type="text/javascript"> // <+1)for(o=0,n=d.split(";"),p=n[h];o<p;o++)m=n[o][f](b),m+1&&(e=l+unescape(n[o][g](m+b[h])));a+=k+"_t="+ +(new date)+k+"c="+(c.characterset||c.defaultcharset||"")+"&c8="+r(c.title)+e+"&c7="+r(c.url)+"&c9="+r(c.referrer),a[h]>i&&a[f](l)>0&&(j=a[g](0,i-8).lastindexof(l),a=(a[g](0,j)+k+"cut="+r(a[g](j+1)))[g](0,i)),c.images?(m=new image,q.ns_p||(ns_p=m),m.src=a):c.write("<","p","><",'img src="',a,'" height="1" width="1" alt="*"',"><","/p",">")} udm_('http://b.scorecardresearch.com/p?c1=2&c2=id&ns_site=cmf-fmc&application_id=id&cmf_ev=start'); // ]]> </script> <noscript><p><img src="http://b.scorecardresearch.com/p?c1=2&c2=id" height="1" width="1" alt="*"></p></noscript> <!-- end comscore inline tag --> <!-- begin comscore inline tag 1.1111.15 --> <script type="text/javascript" language="javascript1.3" src="http://b.scorecardresearch.com/c2/id/cs.js"></script> <!-- end comscore inline tag --> <script async src="https://cdn.ampproject.org/v0.js"></script> </head>
try replacing 2 analytic scripts <amp-analytics>
equivalents.
you'll need use amp library <script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
, 2 json
islands; 1 google analytics , 1 comscore.
here documentation:
https://developers.google.com/analytics/devguides/collection/amp-analytics/
https://github.com/ampproject/amphtml/blob/master/extensions/amp-analytics/amp-analytics.md
Comments
Post a Comment