Add adsbygoogle.js file only once?
-
This may have been asked before but I couldn’t find it with a search.
When I add AdSense to multiple blocks, the
adsbygoogle.js
file:<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
gets added to the HTML multiple times.
I would like to only include it once. I know I could put it in the Header (<head></head>) section separately, which is sort of a solution. BUT, I also uses filters (device, URL) so that there are times when I want no ads to show on a page. In that case, if I put the .js file in the <head> it will load even though it isn’t actually needed, which is inefficient.
I have come up with a solution, which works but is a bit complicated. I am wondering if there is some simple solution that already exists in the settings that I just didn’t think/know about?
- The topic ‘Add adsbygoogle.js file only once?’ is closed to new replies.