After spending two afternoons reading up on the web and numerous trials and errors editing my blogger template, I was finally able to get the Adsense code into the body of my blog successfully. I think it was my 20th attempt. Learned a great deal in the process; that blogger is written in xml and does not communicate with adsense javabscripts and that I need to parse the code so it can be understood when the url is served. Using a code parser found readily on many websites, I parsed the Adsense codes that I had generated and inserted where it should go. It did not work. First it would not let me save the changes, with error message saying that my xml is incomplete. I made some changes the best I could,closing xml tags and when I was finally able to save the changes (assuming my tags are all closed and correct), the ads did not appear and in its place another error message appeared "webpage cannot be found". Having spent 4 hours going through web resources and forums and getting nowhere, I decided enough time is spent and I should just take another look another day.
It was bugging me all night though, it seemed so straight forward and yet I am not able to fix it, what am I missing? I decided to parse my Adsense code using a different code parser from another website. At first, I had the same xml tag not closed error, I looked at it carefully and added <div> at the beginning and </div> at the end. Low and behold, it let me saved the changes. I am making progress!! The ad appears except it is at the top of my blog post, not with the body text around the code. The next thing I decided to do (which I learned a long time ago) is to study source codes of other sites (View -> Source) and see what the difference was between my codes and theirs. I found a webpage that had an Adsense code embedded (wrapped) within his post and I saw he had two additional lines. I added them to mine and that fixed it!!
So here they are:
I inserted the following after <div class='post-header-line-1'/>
</div>
<div class='post-body'>
<div style='float: left; padding: 3px; 3px; 3px; 3px;'>
PARSED ADSENSE CODES
</div>
A few things to do before you start making all these changes, download a copy of the template and save it in case you mess up and need to revert to the working template. Second, make all your changes on notepad until you are ready to copy paste to insert it in your blog template.
P.S In order for the html codes above to appear as they are in my blog post and not to be be confused as a xml code, I had to change first "<" to & and lt (without the space) and that did the trick.
No comments:
Post a Comment