How do I prevent CKEditor 4 from stripping Google AdSense asynchronous tags? For whatever reason, CKEditor 4 is stripping Google AdSense asynchronous tags from my Full HTML text format.

What starts as this (placeholders substituted for IDs):

&lt;script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"&gt;
&lt;/script&gt;
&lt;!-- Top Banner --&gt;
&lt;ins class="adsbygoogle"
    style="display:inline-block;width:728px;height:90px"
    data-ad-client="ca-pub-XXXXX"
    data-ad-slot="XXXXX"&gt;&lt;/ins&gt;
&lt;script&gt;
    (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;


Ends up as this:

&lt;script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"&gt;
&lt;/script&gt;
&lt;!-- Top Banner --&gt;
&lt;script&gt;
    (adsbygoogle = window.adsbygoogle || []).push({});
&lt;/script&gt;


Again, this is in the Full HTML text format and I'm able to get the ins tag through without attributes, but not with attributes, even though other tags have no problems getting their attributes through to save.

For what it's worth, I do have the following set on the CKEditor profile:

config.allowedContent = true;


UPDATE

CKEditor is only stripping the ins tag (and attributes) when it's an empty tag as given by AdSense. If I add anything – a non-breaking space, even – CKEditor is preserving the ins tag and attributes.

Per tenken's suggestion, I added the following line to my config, but it didn't help.

config.protectedSource.push( /&lt;ins class=\"adsbygoogle\" style=\".*\" data-ad-client=\".*\" data-ad-slot=\".*\"\&gt;&lt;\/ins\&gt;/g );
Have you read this blogpost (not by me) Drupal WYSYWG Module Custom CkEditor Configuration by Philip Norton.

Your &lt;script&gt; tags are not being stripped out, but the funky &lt;ins&gt; tag is. From that blog post you should be able to add a protectedSource to the AFC rules so that those elements are not stripped. This is untested but deriving from the blogpost:

// Allow Google Adsense &lt;ins&gt; tags, I'm being more specific
// than allowing any raw &lt;ins&gt; tag here. This may be too specific, but
// play with it.
config.protectedSource.push( /&lt;ins class=\"adsbygoogle\"\&gt;.*?&lt;\/ins\&gt;/g );


In order for this configuration to work you may have to install the WYSIWYG module (or append to your own ckeditor javascript profile directly).