After reading following blog post about optimizing JS integration and differences between async and defer, I decide to implement the adsbygoogle.js into head via defer. I have tested this now a while ago and seems to be working fine.

Perhaps this is also interesting for other ones or maybe we could adapt a configurable solution.

Comments

Comment #1

IT-Cru created an issue. See original summary.

it-cru’s picture

Comment #2

it-cru
Primary language English
Location Munich
commented
Status: Active » Needs review
StatusFileSize
new adsense-load_adsbygoogle_defer_head-3094970-2.patch 2.55 KB

Added patch.

jcnventura’s picture

Comment #3

jcnventura
Primary language English
commented
Status: Needs review » Needs work

The question here is that the module does try to keep in sync with the Google-generated code. The defer tag not generated by Google, so it can't be a default option. Or as is the case in the patch, the only option.

We need a way that the 'async' tag is still default, but that you could choose the 'defer' option. Not sure we can do that using the external library option. Probably it would require to create a template variable that would replace the currently hard-coded async tag.

Comment #4

  • jcnventura committed 10c34ab on 8.x-1.x
    Issue #3094970 by IT-Cru, jcnventura: Load adsbygoogle.js with defer...
jcnventura’s picture

Comment #5

jcnventura
Primary language English
commented
Status: Needs work » Fixed

Comment #6

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.