phplaravelamp-html

The script tag contains invalid JSON that cannot be parsed on custom AMP pages


I make custom AMP page on Laravel and today I got search console error: the script tag contains invalid json that cannot be parsed, but when I check on AMP validator, it shows that the code is valid.

Code:

<amp-analytics type="gtag" data-credentials="include">
    <script type="application/json">
    {
      "vars" : {
        "gtag_id": "UA-xxxxxx-xx",
        "config" : {
          "UA-xxxxxx-xx": { "groups": "default" }
        }
      }
    }
    </script>
</amp-analytics>

After remove this code, I'm not getting warning and also sucessfully submit validation request.

Here is the URL: https://wordkosh.com/amp/english-hindi/administrator-meaning-hindi


Solution

  • I found the same error message and I solved by changing this:

    <script type="application/json">

    becomes..

    <script type="application/ld+json">

    Then submit validation request. This works for me.