Support » Plugin: AMP for WP - Accelerated Mobile Pages » Critical Issue – User-authored JavaScript found on page

  • Resolved enxaqueca


    Seven days ago, the number of non-valid AMP on my site jumped from none to all pages. I have done nothing but upgrade WordPress to the latest version.

    I tried deactivating all other plugins and clearing cache, but the AMP issue persisted.

    On my Google Search Console > Accelerated Mobile Pages, the greatest issue seems to be: “User-authored JavaScript found on page (Critical issue)”.

    Please help.

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author Ahmed Kaludi


    Hi @enxaqueca

    It looks like either you or a plugin that you are using is adding the javascript code of analytics, which is breaking the whole validation. Please see:

    Can you please let me know if you are adding it or what analytics plugin that you are using?

    Hi and thank you. In fact, I have just signed up for AMPforWP’s Priority Support (ID#38972), so we could work out the solution from there and later share useful tips here.

    Before writing this support request, I had tried deactivating all other plugins and clearing the cache.

    The JavaScript I have added in my Genesis > Theme Settings > Footer Scripts are my Google Analytics script for the non-AMP site, and the script for Google Badges (like Google+ Follow, +1). I have tested my pages after temporarily removing these scripts and clearing the cach, but the issue persisted.

    The only <script> I had in my Custom Functions one that I copied from in order to add Analytics tracking code to my AMP pages. I can see that now AMPforWP has a setting where I can do that, so I got rid of that custom funcion. Removing that script, however, did not result in positive changes.

    @ahmedkaludi I understood your question now, sorry I didn’t earlier. The answer is, I added the javascript code for analytics for my non-AMP site myself, without the aid of a plugin. I put this javascript in the footer instead of the header.

    Minutes ago, I changed that and now the javascript code for my non-AMP site has been placed in my Genesis Theme Settings > Header Scripts (as opposed to Footer Scripts, where it previously had been).

    When checking the source of my AMP, however, I could see that the errors, as well as the footer javascript, persist. Does it take a while for this change to take place in the AMP version of my site?

    Curiously, when checking via, the test returns “Valid”. But when I click on View Source Code, I still find the Analytics Javascript for my non-AMP pages at the fotter, just before the </body> tag. I have no idea where that’s coming from. (Also, the tracking code for my AMP pages do not appear in that source code, even though I have set it up at AMPforWP Options > Settings > Analytics.)

    • This reply was modified 10 months, 4 weeks ago by  .
    • This reply was modified 10 months, 4 weeks ago by  .
    • This reply was modified 10 months, 4 weeks ago by  .

    at least I can confirm it is not amp plugin related.

    I also use analytics code, but my pages get validated.

    Plugin Author Ahmed Kaludi


    Hi @enxaqueca

    Our Priority Support team is already working on it and taking care of it for you.

    Hi @ahmedkaludi

    I can see that your team already seems to have taken care of the issue. Both AMP Validator and Google’s AMP Test are returning “Valid”. That was fast, thank you very much.

    It is also possible that the issue got fixed because I followed your advice, above, and removed the Analytics script from the footer yesterday, after which I reported that Google’s AMP Test was returning “Valid”. Maybe, at the time, the AMP validator had been “looking” at the cached page instead of my server. Readers of this thread should take note and check this, should they run into similar issue.

    What matters most is that my AMP is valid again. I’m glad to have hired your Priority Support and will recommend it in my review of the Plugin. Keep up the good work.

    P.S.: Do I need to resubmit my AMP pages to Google? Or will they resubmit themselves?

    • This reply was modified 10 months, 3 weeks ago by  .
    Plugin Author Ahmed Kaludi


    Hi @enxaqueca

    I’m glad to hear that!

    You don’t need to submit the AMP pages, it’ll automatically sent from our side from webmaster tools.


Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Critical Issue – User-authored JavaScript found on page’ is closed to new replies.