How to resolve Async XML parsing error when saving Google Adsense code in Blogger?

Async Error when saving Google Adsense code in Blogger
If you are a Blogger trying to integrate Google Adsense on your blog, you might have encountered and "async error" if you add the Google Adsense code in Blogger template as it is. Google Adsense provides JavaScript code which can be added to websites and blog platforms to display Google Ads. A typical Google Adsense (asynchronous) Code looks like this:
<script async src="//"></script>
  (adsbygoogle = window.adsbygoogle || []).push({
    google_ad_client: "ca-pub-XXXXXXXXXXXXXX",
    enable_page_level_ads: true

The error message on Blogger looks like this:

"Attribute name "async" associated with an element type "script" must be followed by the ' = ' character."
In this post, we will see how to modify the Google Adsense code so that the error is resolve in Blogger templates.

If you get XML parsing error when adding Google Adsense code as it is in Blogger template, then modify the Google Adsense code a bit to resolve the error in Blogger.  A typical Google Adsense (Asynchronouse) code begins with:
<script async src="//</script>
 .......................................... </script>
 And the error says:
"Attribute name "async" associated with an element type "script" must be followed by the ' = ' character."
Which means, Blogger is expecting an equal sign (=) right after the word "async".

Add ="async" right after async in the Google Adsense code.

Before: Orginal Google Adsense code
<script async src="//</script>
 .......................................... </script>
After: modified
<script async="async" src="//"></script>
 After the change, Blogger Template should save successfully without any XML parsing error.

Alternative Way One:

<script async src="//"</script>

Replace parts of the line containing "async" with the following.

1) Replace the starting part: <script async src=" with &lt;script async src=&quot;
2) Replace the ending part:  "</script> with &quot;&gt;&lt;/script&gt;

So the entire line containing async looks like this:
&lt;script async src=&quot;//;&gt;&lt;/script&gt;

Blogger will now save the code without any error.

Alternate Way Two:
If you do not like to fiddle with the Adsense code on your own, you can also take help from online Adsense code parsers such as this Adsense Code Parser (click).

  • Go to the link above and paste the Google Adsense code as it is.
  • Click Convert
  • A parsed code will be generated.
  • Copy the parsed code and paste it in the Blogger template page.
  • Save the Theme.

Comment with Facebook


  1. do you use this same fix on this blog...?

    1. Hi,
      Yes I do. Without the edit, Blogger will always throw the XML parsing error.

    2. Yea....I was also able to fix it instantly using THIS METHOD HERE

  2. Hi,
    Thank you so much for your help! I had no idea how to fix this on my art blog but now no error is showing. :) Have a nice day!
    Diana from

    1. Hi Diana.
      Thanks for your wonderful comment and I am glad the post was of help.
      Cheers! Good Day!

  3. how can we know that this modification in code approves the website after verifying?

  4. Thanks it worked. Now waiting for approval :)

  5. wow yes its working now .... :)


  6. I had similar issues on my Tech blog but fixed it with this Trick

  7. This has worked for me. You are a life saver Albina.


Post a Comment