Home > Enterprise >  AdSense head script element is dropping performance
AdSense head script element is dropping performance

Time:01-12

I'm trying to add ads to my web app and I used adsense and it's telling me to paste this script to the head of the html

<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-secret-client-number"
     crossorigin="anonymous"></script>

Without this script and running lighthouse I get a performance score of 99 and after using it it drops down to 70-75

Should I use Partytown or is there a way around

CodePudding user response:

Use Partytown.

I recently added Partytown to our site. In the research I did for it, I didn't really find anything that offers offloading the script to a web worker like Partytown does. It's fairly simple to implement and provides a significant boost to performance.

It's important to note that it is still in beta, so there may be bugs. But in my experience, working with it has been pretty smooth.

  • Related