Lazy loading on public view

This commit is contained in:
Paulo Gustavo Veiga 2022-09-12 09:59:53 -07:00
parent befb252850
commit 0301c5c63a

View File

@ -41,8 +41,20 @@
</c:if> </c:if>
<c:if test="${requestScope['google.analytics.enabled']}"> <c:if test="${requestScope['google.analytics.enabled']}">
<!-- Google Ads Sense Config--> <!-- Google Ads Sense Config. Lazy loading optimization -->
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4996113942657337" crossorigin="anonymous"></script> <script type="text/javascript">
function downloadJsAtOnload() {
setTimeout(function downloadJs() {
var element = document.createElement("script");
element.setAttribute("data-ad-client", "ca-pub-4996113942657337");
element.async = true;
element.src = "https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js";
document.body.appendChild(element);
}, 2000);
};
window.addEventListener("load", downloadJsAtOnload, false);
</script>
</c:if> </c:if>
<style> <style>