Sign up for PayPal and start accepting credit card payments instantly.



Wednesday, July 18, 2007

AdSense In Blog Post!!

I was at a local forum when I came across this question, from Baloot. I've read lot of these kind of questions while surfing the Internet, and I thought of doing a post about it.

It was easy to copy and paste codes when I was still using Blogger classic template. Now that I'm using the new layout which I found quite difficult at first coz everytime I tried to insert AdSense in the post's body I received these message from good ol' Blogger;

Your template could not be parsed as it is not well-formed. Please make sure all XML elements are closed properly. XML error message: The processing instruction target matching "[xX][mM][lL]" is not allowed.


Since Blogger started using XML everything is more strict and standardized. The above error simply mean the AdSense code is not standardized XML and solve it we need to replace all the HTML character.

This heading may sound misleading. We are not at all altering the code but converting some of the characters to character entities. We have to parse the AdSense code so that it can be included into your Blog template. This essentially involves replacing the following HTML characters:-

< with &lt;
> with &gt;
" with &quot;


Your final Google AdSense Code should look something like this:-

&lt;script type=&quot;text/javascript&quot;&gt;&lt;!--
google_ad_client = &quot;pub-XXXXXXXXXXXXXXX&quot;;
google_ad_width = 336;
google_ad_height = 280;
google_ad_format = &quot;336x280_as&quot;;
google_ad_type = &quot;text_image&quot;;
google_ad_channel = &quot;&quot;;
google_color_border = &quot;FFFFFF&quot;;
google_color_bg = &quot;FFFFFF&quot;;
google_color_link = &quot;000000&quot;;
google_color_text = &quot;000000&quot;;
google_color_url = &quot;000000&quot;;
//--&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;
src=&quot;http://pagead2.googlesyndication.com/pagead/show_ads.js&quot;&gt;
&lt;/script&gt;

Insert code into template

Login to your Dashboard. Go to Template -> Edit HTML and checked the box next to “Expand Widget Templates”. Before you do any editing, back-up your template. This is very important. If anything goes wrong, you can easily paste and copy it back again.

Now search for post.body through your browser's search function (Ctrl+F for Firefox and IE). You should see these lines :-

<div class='post-body'>
<p><data:post.body/></p>
<div style='clear: both;'/> <!-- clear for photos floats -->
</div>


If you want the AdSense ads to appear between the post title and post body, add the following code above the red lines. If you want the AdSense ads to appear immediately after every individual post, add the following code below the red lines. The code to add is :-

<div style="float:left;">
--AdSense Code--
</div>


2. If you want to paste AdSense before credit, as you can see it here (on this blog, Web Directory I used Auction Ads, so I used My Journey To Recovery as an example. Click on the pic. to see it more clearly!);



The codes you will use is like this;

<div class='post-body'>
<p><data:post.body/></p>
<div style='clear: both;'/> <!-- clear for photos floats -->
</div>

<div><!--parsed Adsense code--></div>

<div class='post-footer'>
<p class='post-footer-line post-footer-line-1'>
<span class='post-author'>
<b:if cond='data:top.showAuthor'>
<data:top.authorLabel/> <data:post.author/>



3.If you want to paste AdSense after the credit, here is the codes ;

<p class='post-footer-line post-footer-line-3'/>

<div><!--parsed Adsense code--></div>

</div>
</div>
</b:includable>
</b:widget>
</b:section>


That's all for now. I hope this short about wrapping AdSense around your texts will be useful.

It has come to my attention, you can parsed your AdSense easily by using HTML Parser at BlogCrowds rather than doing it manually like I did.

For further reading to widen your read these post and these.

Have a good day!



Subscribe to My Journey To Recovery

A candle loses nothing by sharing its flame.

29 Responses to "AdSense In Blog Post!!"

baLooT Don JuaNer said...

thanks bro...

i'll appreciate ur hardwork..

sy dah letak adsense dlm post..

tgk2 la blog2 sy... heheh..

thanks again...

xicom from 11xi85.com said...

I recently was playing around with Adsense after a long break from it (not on my current blog, but on a different page), and now adsense code is MUCH smaller.

It seems that now when you make an ad in adsense, it stores that ad, along with all of it's attributes under your account and assigns it a number. Now, when you embed Adsense into your website, the code is nothing more than just a few lines and one of them referencing that ID number to pull up the ads attributes.

I really didn't like it very much because it makes modifying the code much more difficult because now you have to log in and change it there or create a new ad instead of just changing a few parameters in the code. I guess they did it this way to make it slightly harder for people to modify Adsense code... I don't know.

Anonymous said...

Hі! Someone in my Facebook group shared this
websіte with us ѕο I camе to give it a lοok.
I'm definitely enjoying the information. I'm bookmarκіng and ωill be twеeting
this to mу fοllowеrs! Terrific blog and tеrrific stylе and
design.

My web pagе; free Ps3

Anonymous said...

It's a pity you don't have a donatе buttοn!
I'd most certainly donate to this excellent blog! I suppose for now i'll settle foг bοok-mаrking аnd adԁing youг RЅS feеԁ to my Google acсount.
I look forωaгԁ to brand new updateѕ
and will talκ about thіs blog ωith mу Facebook grοup.
Talκ soоn!

Also visit mу web sitе :: lose belly fat fast

Anonymous said...

I'm really enjoying the design and layout of your site. It's a veгy eаsy оn
the eyes which makеs it much mοгe enjoyable foг me
tο come heгe and ѵisit mοrе often.
Dіԁ you hire out a dеsigner to crеate your theme?
Οutstandіng woгk!

Fеel frеe to ѵisіt my web-site: bigger breasts

Anonymous said...

Supeгb blοg! Do уоu haνe anу tips
and hints fοr aѕpiring writers? I'm planning to start my own blog soon but I'm a little lοst on everуthing.

Wοulԁ you pгopоse ѕtarting with a
free platfоrm like Woгdpress oг go for
a paid optіon? There are so manу
choicеs out there that Ι'm totally confused .. Any ideas? Many thanks!

my website natural breast augmentation

Anonymous said...

Hi there! Thiѕ is kind of off tοpіc but Ι need ѕome help frοm аn eѕtablisheԁ
blog. Is it very hагd to set up your own blog?
Ӏ'm not very techincal but I can figure things out pretty fast. I'm thinking about setting
up my own but І'm not sure where to start. Do you have any ideas or suggestions? With thanks

Also visit my web site :: How To Lose Belly Quickly

Anonymous said...

Hi, just wanted to tell you, I enjoyed this post. It was funny.
Keep on posting!

Also visit my web page :: Cheap Jerseys

Anonymous said...

My developer is trying to convince me to move to .net from PHP.
I have always disliked the idea because of the expenses.

But he's tryiong none the less. I've been using Movable-type on various
websites for about a year and am anxious about switching to another platform.
I have heard fantastic things about blogengine.net.
Is there a way I can transfer all my wordpress content into
it? Any help would be greatly appreciated!

Also visit my homepage :: Gucci Borse

Anonymous said...

Ηello there! Would you mind іf I shаre your blоg with my facebook
gгοup? There's a lot of folks that I think would really enjoy your content. Please let me know. Thanks

Here is my web site :: how to get rid of heartburn

Anonymous said...

What a data of un-ambiguity and preserveness of valuable know-how regarding unexpected emotions.


Here is my homepage Montre Guess

Anonymous said...

Hey thегe! Ι сould have swοrn
I've been to this blog before but after reading through some of the post I realized it's new to me.
Αnyways, І'm definitely happy I found it and I'll be bookmarking and checking back frequentlу!


my blog pοst how to lose belly fat

Anonymous said...

Excellent blog here! Also your web site loаdѕ uр fast!
What hoѕt aге you using?
Cаn I get your affiliatе link to your host?
I wiѕh my site loaded up аs quicκly аs yours lol

Also visit my page: spa in birmingham

Anonymous said...

My family members always say that I am wasting my time here at net, however I know I am getting know-how everyday by reading
thes nice articles or reviews.

Feel free to surf to my web page Wholesale Jerseys

Anonymous said...

Very gооԁ blog! Dо
you havе any tips fοr аspігing wгitегs?
I'm planning to start my own blog soon but I'm а little
lost οn eѵerythіng. Would you rеcommend starting
wіth a frеe plаtform liκe Wordpress οг go
for a рaiԁ option? Тhere aгe so mаny сhоiceѕ
out thеrе that I'm totally overwhelmed .. Any suggestions? Cheers!

Look at my page ... trim belly Fat fast

Anonymous said...

I just like the valuable information you provide on your
articles. I'll bookmark your blog and take a look at again right here regularly. I am somewhat certain I will be told plenty of new stuff right here! Good luck for the following!

Also visit my web page :: http://www.explorethecapabilities.com/louisvuittonoutlet.html

Anonymous said...

Hey there, You have done a great job. I will definitely
digg it and personally suggest to my friends. I am sure they'll be benefited from this website.

My web blog :: Tory Burch Handbags

Anonymous said...

This post will assist the internet users for creating new
blog or even a blog from start to end.

Take a look at my page http://ngosummit.com

Anonymous said...

Hi there! Would you mind if I share your blog with my zynga group?

There's a lot of people that I think would really enjoy your content. Please let me know. Cheers

Feel free to surf to my web site: Wholesale Jerseys

Anonymous said...

Why viewers still use to read news papers when in this technological globe the whole
thing is available on web?

my web-site; More Help (http://fangxuela.com/)

Anonymous said...

Thanks in support of sharing such a good thought, post is fastidious,
thats why i have read it fully

Look into my homepage :: Nike Pas Cher

Anonymous said...

This post provides clear idea in support of the new visitors of blogging, that truly how to do blogging and
site-building.

Visit my blog ... Abercrombie Et Fitch

Anonymous said...

I think the admin of this site is truly working hard in support of his web site, since here every data is quality based
stuff.

Feel free to surf to my page: Air Max

Anonymous said...

Hiya very cool web site!! Guy .. Beautiful .
. Superb .. I will bookmark your blog and take the feeds additionally?
I am glad to search out so many helpful information right here within the put up, we need
develop extra strategies in this regard, thanks for sharing.
. . . . .

Feel free to visit my site :: Soldes Air Jordan

Anonymous said...

Excellent blog post. I absolutely love this site.
Thanks!

Also visit my weblog: Sac Guess

Anonymous said...

It's awesome in support of me to have a website, which is good in support of my know-how. thanks admin

Feel free to visit my page ... next page

Anonymous said...

Undeniably consider that that you said. Your favorite justification seemed
to be at the net the simplest factor to take into account of.

I say to you, I definitely get annoyed while people consider worries that they just do not
recognise about. You managed to hit the nail upon the highest and defined out the entire thing with no need side-effects ,
people could take a signal. Will likely be again to get more.
Thank you

Take a look at my blog post ... Sac A Main Louis Vuitton

Anonymous said...

What's up to every , because I am actually eager of reading this blog's post to be
updated regularly. It contains fastidious information.


Feel free to visit my web-site ... Louis Vuitton Purses Outlet

Anonymous said...

I am curious to find out what blog platform you happen to be utilizing?
I'm having some small security problems with my latest blog and I would like to find something more secure. Do you have any recommendations?

Stop by my blog post Louis Vuitton Pas Cher

Post a Comment

I loves to receive comments from everybody and I tried to make everything easier for my readers to comments. So please, be nice even though you totally disagree with me. No comment moderation and whatnot here. So, please respect the privileges given.

God's willing, all comments will be followed and replied.

p/s Please leave your URL so that I can follow it and leave comments on yours. No URL = No Comments. It is as simple as that. Thank you in advance.


~ ArahMan7

PS - Word verification has been enable. Sorry about that [Sept 3rd, 2013].



Back To Top