Error - Asynchronous AdSense HTML Code

I am a blogger and monetize my blog with adsense. When coding or, in fact, adding asynchronous code inside the tag of <head></head>my blog, it seems to me that I should add it as follows:

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

instead of this:

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

Otherwise, it will show me an error. Can anyone explain why? Do you know if this can be added (according to adsense)?

+3
source share
3 answers

Use this code instead in any of them ... I am currently using this ... Try

<script async='async' src='http://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js'></script>
Run code
+11
source

You are writing an XHTML document (due to Content-Typeor declaring an XML).

, XML.

HTML, XML .

+1

Hubspot Blogger.

When I add the following code to the HTML theme in Blogspot, I get an error.

XML parsing error, line 2490, column 62: the attribute name "async" associated with the element type "script" must be followed by the symbol "=".

<!-- Start of HubSpot Embed Code -->
<script type="text/javascript" id="hs-script-loader" async defer src="//js.hs-scripts.com/xxxxxx.js"></script>
<!-- End of HubSpot Embed Code -->

I found that using the above fix changes async defertoasync="async defer"

<!-- Start of HubSpot Embed Code 17/03/2017-->
<script type="text/javascript" id="hs-script-loader" async="async defer" src="//js.hs-scripts.com/2336222.js"></script>
<!-- End of HubSpot Embed Code -->
0
source

All Articles