Home » Development » Solved: “Custom JavaScript is not allowed” (Google Search Console – AMP issue)

Solved: “Custom JavaScript is not allowed” (Google Search Console – AMP issue)

AMP (Accelerated Mobile Pages) is an initiative to make web pages faster and more compatible across different devices and browsers. It is lead by AMP Project. A library is provided for web developers. In this post, I will explain how to fix a popular AMP issue.

Google supports AMP Project and provides tools and guidance to integrate AMP web pages with Google tools such as Search and Analytics (Receiving an issue with cookies while using Google services? Check out this blog post).

You can check if your website is AMP-ready by using Google Search Console. If there are any issues in any of your web pages, an error message will be displayed in Search Console Dashboard. Here is one of the error messages displayed most:

Custom JavaScript is not allowed

<script>'undefined'=== typeof _trfq || (window._trfq = []);'undefined'=== typeof _trfd && (window._trfd=[]),_trfd.push({'tccl.baseHost':'secureserver.net'}),_trfd.push({'ap':'cpsh'},{'server':'xx'}) // Monitoring performance to make your website faster. If you want to opt-out, please contact web hosting support.</script><script src='https://img1.wsimg.com/tcc/tcc_l.combined.1.0.6.min.js'></script></html>

Search Console Custom JavaScript is not allowed AMP issue

Solution for “Custom JavaScript is not allowed” AMP issue

The root cause of this problem is that the feedback code implemented to your page by your hosting provider (It’s GoDaddy in my case).

As mentioned in the page code (If you want to opt-out, please contact web hosting support), GoDaddy recommends contacting Customer Support to fix this problem. However, you can make necessary configuration by yourself. You just need access to your website’s control panel on GoDaddy.

Follow the steps below to fix this issue for websites hosted by GoDaddy:

  1. Login to your control panel
  2. Click the details icon (three dots in a row “…”) on the top right side of the page
    GoDaddy control panel AMP issue
  3. Click “Help us”
  4. Click “Opt out”
    GoDaddy opt-out AMP issue

After opting out from the feedback system, click “Validate Fix” button in your Google Search Console. Then you should patiently wait. It may take a few days from Google to scan your pages and mark the issue as fixed.

You can always go back to the same page and opt in for feedback back.

Ned Sahin

Blogger for 20 years. Former Microsoft Engineer. Author of six books. I love creating helpful content and sharing with the world. Reach me out for any questions or feedback.

17 thoughts on “Solved: “Custom JavaScript is not allowed” (Google Search Console – AMP issue)”

  1. **If you are using WordPress and have this issue,**

    Google Search console was throwing an error for a few of my WordPress Blog pages. Google was not able to index my AMP pages for my Blog. The error was that some custom JavaScript and CSS were injected into the AMP pages. Upon investigation, I found out that W3 Total cache was injecting minified JS (JavaScript) and CSS (Cascading Style Sheets) links into the pages.

    **Errors showing up in search console:**

    Custom JavaScript is not allowed

    External stylesheets not supported, except for whitelisted font providers.

    **Why this error comes up?**

    Well, AMP pages should be lightweight so that it loads very fast on slow mobile devices. And as such there should be no javaScript or CSS in your AMP pages. Whenever Google bots find it, it throws an error.

    **How to fix?**

    For W3 Total Cache you need to activate the AMP extension. This will remove all the custom JS and CSS from the AMP pages. Go to your site Admin Dashboard – Performance – Extensions and activate AMP. W3 Total Cache comes built-in with the extension. You just need to activate it.

    Reply

Leave a Comment