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>
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:
- Login to your control panel
- Click the details icon (three dots in a row “…”) on the top right side of the page
- Click “Help us”
- Click “Opt out”
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.
Thank you. These instructions worked perfectly for me and saved me a bunch of time.
Nice! Information objectif ..
How can i use this method if i have wordpress hosting?
But I am using A2 hosting. It is showing many errors. Please help me out.
Thanks, Brooo That helped me!!1
nice it works
Thanks dude
**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.
what about wp rocket
Thank you so much, bro Information is very Helpful work properly.
Thank You so much, bro trick is very useful.
Hey, there are no three dots beside the c panel, in my case. please help.
thanks for the information i am going to solve this issue your way.