cancel
Showing results forย 
Search instead forย 
Did you mean:ย 

Magento 2 Direct Post Integration - Checkout error with JS in footer

Hello,

 

We are having an issue with our Magento 2 store and authorize.net checkout. We have been doing some performance updates trying to improve the site speed and SEO rankings, one of those updates is moving all JS to the footer to avoid the render blocking scripts. We are doing this with a certified Magento extension from Amasty: Amasty - Google Page Speed Optimizer

 

The feature itself seems to work great, all the JS gets migrated to the footer and the site functionality is still working great, besides checkout. Being that checkout is the most important feature, we currently can't implement the JS in the footer on production which is causing some mobile page speed issues. And I am rather certain this is the issue because when I turn off the "JS in footer" feature, the checkout works right away.

 

Has anyone experienced issues with this before? Any ideas or workarounds we can implement? Any and all help is appreciated, thank you!

 

 

fjorgeDigital
Member
3 REPLIES 3
I donโ€™t know what your code is and with magento you may not have much ability to directly edit things (as much as you would a hand coded site from scratch), but if you add a defer attribute to the script loading tags it has the same effect as moving the js to the footer.

Second, youโ€™ve got to look at these page speed insights with a little analysis. They are super useful but being dumb computers with no judgement they will sometimes make a big deal out of nothing. So youโ€™ll get a failed audit over render blocking js or in my case I get them over not optimizing photos to save 4kb of bandwidth.

So if you go to your mobile phone and the page is very slow to load that is one thing. If you use an online analysis it pays to be critical at times. Last I heard googles stated ideal target is a .5 second above the fold page load, and they donโ€™t start penalizing you until you exceed 2 seconds. So you can go to an online tool that will measure your actual load speed as opposed to what percentage of available optimizations you have in place. If your load speed is less than 2 seconds youโ€™re pretty ok.

And yet another fix would be to inline the JavaScript. That would accomplish what you need as long as your script isnโ€™t massive.
Renaissance
All Star

Why you don't set js in the <head>, on my website (https://simthanglong.vn), js and css set in the head, So let me ask it affect to do with google reading time.

simthanglong
Member

Please, help me edit my css in <head>...</head>, my web (https://cashberry.vn)