Load 3rd-Party JS without hurting PageSpeed Insight Score

Is Google AdSense, Facebook SDK, Twitter Platform JS affecting your PageSpeed Insight score?

Don’t worry! I have come up with a solution. :wink:

Audio starts from 0:24

4 Likes

Is this method make page loading faster in real or its only good for pagespeed score ?

PSI only.

In this case u are likely using auto adsense?

The issue is coming on how to place gtm code for ad tags which are in a precise location.

lets assume there is a sidebar ad tag. It is in the sidebar. I place this sidebar adsense ad code in GTM.

Now, how do i make GTM execute that sidebar ad in the sidebar only?? Via CSS or how? please let me know ur thought.

In that case, I would recommend a simple approach: Using regular Ad units.

Just load once adsbygoogle.js from the GTM > Add new Tag > custom HTML > Trigger on All pages.

<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>

Rest part can be inserted via HTML Widget in the WordPress.

<!-- GK Sidebar ad units -->
<ins class="adsbygoogle"
     style="display:inline-block;width:300px;height:250px"
     data-ad-client="ca-pub-7273XXXXXXXXXXX"
     data-ad-slot="318XXXXXX"></ins>
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script>
1 Like

will this make Analytics plugin redundant if I load analytics from gtag?

So what is the benefit

Yes, it will work.

1 Like

Just show off for the fun! :joy:

2 Likes

in search console you see that page speed report… those all red might become yellow or green

2 Likes

I don’t use GTM. So how can I use this?