Google adsense JS ads are not working in TinyMCE editor?

4 posts by 3 authors in: Forums > CMS Builder
Last Post: September 4, 2019   (RSS)

By (Deleted User) - August 16, 2019

I am using TinyMCE text editor. I want to add AdSense code in the blog post but when I add AdSense JS ad code in source code(TinyMCE source code) it converts into HTML like this -

I add this JS code in TinyMCE source code-

<scriptasyncsrc="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script><insclass="adsbygoogle"style="display:block;text-align:center;"data-ad-layout="in-article"data-ad-format="fluid"data-ad-client="ca-pub-206XXXXXXXXX"data-ad-slot="3413807300"></ins><script>(adsbygoogle = window.adsbygoogle ||[]).push({});</script>

TinyMce converts this JS ad code to -

<p><script></script></p><p></p><p><script>// <![CDATA[(adsbygoogle = window.adsbygoogle ||[]).push({});// ]]></script>

How to add AdSense ads code in TinyMCE with some JS code. I don't want convert source code to HTML etc like this.

By daniel - August 16, 2019

Hi Vishal,

There's no easy way to override the HTML formatting that happens in the WYSIWYG fields, though in general, they're not ideal for inserting things like JavaScript. My recommendation would be to add a new text field or text box specifically for this adsense code. Text fields and text boxes should both keep your JS intact.

Let me know if you have any other questions!

Thanks,

Daniel
Technical Lead
interactivetools.com

By (Deleted User) - August 18, 2019

How can I do this ?