Store Adsense Ads In Posts With Callers Using Javascript

Blogboosters.net - The trick of storing Adsense ads in posts with this caller is because I have requests from friends of the Magic Company. With this trick, we can store Adsense ads anywhere in the post according to our will.

Actually, this is almost the same as how to store Adsense ads in the post manually, it's just that here we don't store the ad code directly in the post, but we only store the caller code.
Google Adsense Ad

So with this, we can easily replace ad units or replace ads with other accounts without having to edit posts one by one. We only need to replace the ad code in HTML editing only.

Actually, in Google, there have been many articles discussing how to save Adsense ads in posts automatically, but there are some bloggers who feel uncomfortable in this way because the placement of ads in posts is out of our control in full.

For that, you can try this trick, so that the ad will appear according to our will.

To start trying the trick of storing Adsense ads in the middle of posting with this caller, please copy the code below above </body>or it can be stored in an HTML / JavaScript widget in the sidebar or footer.


<script>
//<![CDATA[
var element = document.getElementById("insertad");
element.innerHTML = "<ins class='adsbygoogle' data-ad-client='xxxxxxxxxxxxx' data-ad-format='auto' data-ad-slot='xxxxxxxxx' style='display:block'></ins>";
var newScript = document.createElement("script");
var inlineScript = document.createTextNode("(adsbygoogle = window.adsbygoogle || []).push({});");
newScript.appendChild(inlineScript);
element.appendChild(newScript);
//]]>
</script>

Please change the code that I mark with a code like that from your Adsense ad code. Pay attention to each quotation mark from the ad code with a single quote instead of double quotation.

Then please use this code to call ads, please save in the post as you wish in HTML posting mode.



<div id="insertad"></div>


 If you want to save other ads, please create the code above with a different caller ID. You can use the following code for the second ad.


<script>
//<![CDATA[
var element2 = document.getElementById("insertad2");
element2.innerHTML = "<ins class='adsbygoogle' data-ad-client='xxxxxxxxxxxxx' data-ad-format='auto' data-ad-slot='xxxxxxxxx' style='display:block'></ins>";
var newScript2 = document.createElement("script");
var inlineScript2 = document.createTextNode("(adsbygoogle = window.adsbygoogle || []).push({});");
newScript2.appendChild(inlineScript2);
element2.appendChild(newScript2);
//]]>
</script>


And use this code to call a second ad, please save it in the post as you wish in HTML posting mode.


<div id="insertad2"></div>

Maybe useful.



Comments

Popular posts from this blog

7 Functions of VPS You Need to Know

Google Algorithm 2018 and Change Your SEO Strategy

5 Best Battle Royale Games (PUBG) on Smartphones

Increase Blog Traffic By Setting Permalink

How to Create SEO Friendly Blog Post Title

HTML Color Code and How to Use it

The Ideal Way to Get Ideas for Writing

Creating Sub Domains from Custom Domain Blogspot

Comparison of WordPress Advantages With Other Platforms

How to Create Free Website with Weebly