""Defer" for third-party JavaScript works only on desktop

Posted in: Newspaper
Post count: 28

I have a problem with pagespeed, so I had to put “defer” to all scripts about google ads.
This worked for desktop, but not for mobile. In the panel all script about ads have “defer” and also Mobile ADS in the mobile panel.

is there something else that call js from google ads? (like pagead2.googlesyndication.com or something like that)
for example:
<script defer src=”https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script&gt;
I have same problem with google analytics (works only for desktop the “defer”)

in the mobile code I have this:

where can I edit that?

Post count: 35449

Hi,

I do not quite understand the JavaScript is not loading on mobile? please provide some more details, also a link to your website where I can check this problem will be very helpful.

Thank you!

Post count: 28

It is loading, but I want to “defer” the script about Google Ads, to load js after the loading of page. This is to improve pagespeed (I have warning about “third party code”, all by google)

So I tried to “defer” the scripts, but works only to desktop.
This is website: notizieoggi24.it

Post count: 35449

Hi,

So if you need to set the code in header of mobile theme, then you can add it in this file -> wp-content/plugins/td-composer/mobile/header.php

Thank you!

Post count: 28

no I dont need to add, but to “defer” all the google’s scripts about ads.
For example I have this as ADS:
<script defer src=”https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script>
For desktop works (script loads after html parsing)
For mobile dont

Post count: 28

The problem is this:

I have resolved on desktop (with “defer” on google’s scripts) but on mobile still is there (I have put “defer” into mobile scripts)

Post count: 35449

Hi,

All the code for mobile can be found in this folder -> wp-content/plugins/td-composer/mobile
Also here are some topics about:
Loading Third-Party JavaScript -> https://developers.google.com/web/fundamentals/performance/optimizing-content-efficiency/loading-third-party-javascript
Reduce the impact of third-party code -> https://web.dev/third-party-summary/

Hope this will help you!
Thank you!

Post count: 28

Yes, I have found that folder, but there are many php files. The problem is about JS.
I need to know why the “defer” option in the script of ads (for mobile) doesnt work.
I have this:

For something that I dont know, this “module” works for desktop (that defer the scripts), but not for mobile. Maybe mobile script are managed differently than desktop.

Post count: 35449

Hi,

If you want, you can send us an email at contact@tagdiv.com and provide admin login. We will take a look and we’ll try to investigate this problem. Include a link to this topic in the email.

Thank for your understanding!

Viewing 9 posts - 1 through 9 (of 9 total)
The forum ‘Newspaper’ is closed to new topics and replies.