Showing posts with label DFPSB. Show all posts
Showing posts with label DFPSB. Show all posts

Saturday, February 5, 2011

DFP Small Business and Blogger - Javascript in Posts

Being fairly new to Blogger there are still some tips and tricks that are new to me, and maybe to you too.

When I first placed my DFP tags into the previous post they didn't work. Curious I thought! I know that Google is very big on stopping cross site scripting injection and figured maybe this was the reason why the code wouldn't work.

A further inspection of the code however showed a much easier issue to resolve as a user of Blogger.
DFP Small business tagging instructions tell you that you need to put the script loading code into the Header of your webpage, however in the case of CMS systems and blogging platforms like Blogger you can infact paste this code into the beginning of your post.

Here is the code as it should appear:
<script type='text/javascript' src='http://partner.googleadservices.com/gampad/google_service.js'>
</script>
<script type='text/javascript'>
GS_googleAddAdSenseService("ca-pub-8884734375688780");
GS_googleEnableAllServices();
</script>
<script type='text/javascript'>
GA_googleAddSlot("ca-pub-8884734375688780", "Training_Bunyip");
GA_googleAddSlot("ca-pub-8884734375688780", "Training_Cat");
GA_googleAddSlot("ca-pub-8884734375688780", "Training_Dog");
</script>
<script type='text/javascript'>
GA_googleFetchAds();
</script>
Here is the code as it did appear in my Blog:
<script type='text/javascript' src='http://partner.googleadservices.com/gampad/google_service.js'><br /></script><br /><script type='text/javascript'><br />GS_googleAddAdSenseService("ca-pub-8884734375688780");<br />GS_googleEnableAllServices();<br /></script><br /><script type='text/javascript'><br />GA_googleAddSlot("ca-pub-8884734375688780", "Training_Bunyip");<br />GA_googleAddSlot("ca-pub-8884734375688780", "Training_Cat");<br />GA_googleAddSlot("ca-pub-8884734375688780", "Training_Dog");<br /></script><br /><script type='text/javascript'><br />GA_googleFetchAds();<br /></script><br />
The issue is all the additional line breaks, that is when I had tried to cut and paste the scripting code into the post Blogger had inserted this code into my code automatically:
<br />
This causes the browser to parse the Javascript as HTML rather than Jscript and so the ad placements fail to work because the Javascript pre-loaders are not running.
The good news is that this is really easy to fix!
Go to the dashboard of your Blog and go to the "Settings" tab and then the "Formatting" tab:

Make sure that your "Convert Line Breaks" setting is changed to No like so:
Voila! Your in post Javascript now works as intended and you can put DoubleClick for Publishers ad tags into your Blogger posts!

Monday, January 31, 2011

DFP Small Business Ad Tagging


This post is mostly for myself to do some training on DFP Small Business - the direct ad manager sales product for DoubleClick. Combined with AdSense backfill this ensures that you can sell premium inventory while never running out of ad content to serve on your website.
You can see a great introduction to DFP Small Business on YouTube, DFP Small business is a great free advertising product for Small to Medium Enterprises.
You might be interested in the following training videos that I used to set up these ads:
  1. Creating ad units
  2. Setting up content based placements
  3. Generating Tags


This ad should show kitties! 

 
  This ad should show puppies! 


  This ad I'm going to purposely have no content sold to the placement and have it back filled with AdSense data.