Adding AdSense JavaScript In Wordpress Blog
Google AdSense code is based on JavaScript language, adding this code to a Wordpress blog can be very difficult.
Google Adsense program add new product form time to time and the exiting plugins sometime don’t enable you to use this new products.
In previous post I have reviewed two wordpress plugins AdSene Deluxe and AdSense Manager that will make you life easier and do almost all the work for you.
In this post I’ll take a different approach an show how it could be done manually and even how can you use the existing plug to add different adsense JavaScript code or any javascript code.
I have discovered this method in linkrain.com blog ad decided to expend it.
Lets begin by understand why can’t we just add the code in the source code of any post ?
When we add javascript code directly in the wordpress admin panel, it is treated as an html code. The reason for that is inside wordpress core files. We can’t change this and to be more specific we don’t want to change for security reasons.
The manual and difficult way
After reading the official wordpress documantion I have found that the manual way to add a javascript code in wordpress is by creating an external java script file that include that script the we want to execute.
This script script should be in a function, a one that we can call to in our wordpress files.
For example:
function updatepage()
{var m=”Page updated “+document.lastMo…….}
Now we need to call that script from inside of our post. In order to perform this task we need to shutdown the rich editor in our wordpress panel. Not doing so will clip the SRC tag.
To call for the above function in our post we can use this code:
</script>
<script type=”text/javascript”> <!– updatepage(); //–>
<script type=”text/javascript” src=”/scripts/updatepage.js” mce_src=”/scripts/updatepage.js”>
</script>
hat conclude the manual way to add AdSense javascript code in one single post.
You can see that is method is def***enlt not and easy one and can be used all the time because it’s time consuming.
The good and easy way
If you want to add the familiar AdSense ads that use the above plugins that I mentioned, but if you you want to add a new product from the AdSense program or even some javascript code on that you can’t find a plugin to support yet, then here is the way to do it easily and quickly.
We will use the AdSene Deluxe for wordpress this plugin was designed to help us to put AdSense blocks in you wordpress blog.
But as you already know AdSense code is using javascript, so can use the AdSense Deluxe plugin to add any javascript code to our blog including new AdSense program products.
All you need to do is create a ad block fill the tag name in the name felid and put the javascript in the AdSense code felid.
Here is a screenshot of the AdSene Deluxe control panel:
To use your javascript code in you post all you need to do is just add the appropriate tag like :
<!--adsense#name-->
I know this sound obvious but you will be amazed how many people don’t even think about it.
You can also use the AdSense Manager plugin to do the same thing, didn’t check it yet but after all javascript is still javascript.
Enjoy this one and increase your income from your site.














How can i add adsense script, if i don’t have access to upload plug-in?