{"id":4369,"date":"2018-06-12T11:38:56","date_gmt":"2018-06-12T06:08:56","guid":{"rendered":"https:\/\/susanta.org\/?p=4369"},"modified":"2018-06-20T11:10:46","modified_gmt":"2018-06-20T05:40:46","slug":"google-amp-javascript-error","status":"publish","type":"post","link":"https:\/\/susanta.org\/google-amp-javascript-error\/","title":{"rendered":"User-authored JavaScript found on Page: Fix Google AMP Error"},"content":{"rendered":"
Recently, I got the following warning in Google Search Console:<\/p>\n
User-authored JavaScript found on page (Critical)<\/p>\n
Remove any custom JavaScript code from your page. AMP pages with custom JavaScript may appear in Google search results without AMP-specific display features.<\/p><\/blockquote>\n
When you\u2019re on the Google Console Dashboard, the screenshot might look some like this:<\/p>\n
<\/p>\n
AND, Here\u2019s a screenshot of the warning.<\/p>\n
<\/p>\n
When I clicked on one of the affected AMP pages, I could see the following window with details of the error message.<\/p>\n
<\/p>\n
Although I could have easily ignored this warning but I hate seeing errors. So, I decided to dig in to figure out what might have triggered the errors.<\/p>\n
If you are seeing similar issues, read on to know how to fix it.<\/p>\n
Run AMP Validator<\/h2>\n
Although the warning already says your AMP page has some custom JavaScript, you need to run the AMP validator to establish the details of the issue and where exactly it appears in your page source.<\/p>\n
Therefore, you need to go to the AMP Validator tool<\/a> and enter the URL of the AMP page and hit on the \u201cValidate\u201d button.<\/p>\n