Setup Lazy Loading for AdSense Ad Units in Just 2 min

This method works for lazy loading MediaVine, Disqus, and other 3rd party script as well.

2 Likes

@gulshan I have created a hook in generatepress theme for google analytics. Is Flying Analytics by WP Speed Matters is lighter option ? I am using this code (written below), should i use MinimalAnalytics,js code instead
!-- Global site tag (gtag.js) - Google Analytics →

window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-XXXXXXXX-2'); </script

Yes, you can use that plugin. It is a lightweight option.