Incorporating a YouTube video in PrestaShop is seemingly simple, just enable iframe support in HTML fields, but this leads to a noticeable increase in page load and a worsening of speed score . The browser must upload additional information to render the YouTube video player, even when the visitor does not view the embedded video. With consequent increase in web page load times and indexing penalization by search engines. Another drawback is that the YouTube embed code is not responsive and not suited, for example, with mobile devices.
Google+ uses intelligent technology to embed YouTube videos, incorporating just the video preview image and the player only when the user decides to view it.
To insert a similar feature in your ecommerce in PrestaShop, simply install and activate our Light and Responsive YouTube Embeds module and insert the following code into the HTML code where you wish to display your video:
<div class="youtube-player" data-id="VIDEO_ID"></div>
In place of the usual iframe:
<iframe width="560" height="315" src="https://www.youtube.com/embed/VIDEO_ID" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>
Where VIDEO_ID is the id of the YouTube video you want to embed.
@CUSTOMER_NAME@
@AUTHOR_PROFILE@ @COMMENT_ISO_COUNTRY@@COMMENT_TITLE@
@COMMENT_COMMENT@