How To Resolve Async XML Parsing Error When Saving Google Adsense Code in Blogger

Have you encountered an XML parsing error when adding the new Google Adsense JavaScript code on your Blogger Blog? After you might have successfully added the Adsense code to your Blogger Blog and when you are trying to save it brings you an "Async XML Parsing Error".

On this post, I will show you on how to resolve this error and add the new Google Adsense JavaScript code on your Blogger Blog.


Steps on How To Resolve Async XML Parsing Error When Saving Google Adsense Code in Blogger

The Google Adsense JavaScript code enables Google Ads to be displayed on your blog. Below is a typical example of what the new code looks like.

Code:

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
  (adsbygoogle = window.adsbygoogle || []).push({
    google_ad_client: "ca-pub-XXXXXXXXXXXXXXXX",
    enable_page_level_ads: true
  });
</script>


The error message looks this:


Error Message:

"Attribute name "async" associated with an element type "script" must be followed by the ' = ' character."


Blogger is expecting an equal sign (=) right after the word "async" followed by another 'async' before the src= so all you need to do is to modify the Google Adsense Code. See modification below:


Before: The Original Adsense Code

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
  (adsbygoogle = window.adsbygoogle || []).push({
    google_ad_client: "ca-pub-XXXXXXXXXXXXXXXX",
    enable_page_level_ads: true
  });
</script>


After: Modified

<script async='async' src='//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js'/>
<script>
  (adsbygoogle = window.adsbygoogle || []).push({
    google_ad_client: "ca-pub-XXXXXXXXXXXXXXXX",
    enable_page_level_ads: true
  });
</script>



After adding the code in red, Click on the Save Theme button, Template should save successfully without any XML parsing error. You are done!