by Michael Wolski
23. February 2010 00:18
If you haven't already discovered it, BlogEngine.Net is an excellent, extensible, and free! blog engine. In fact it is what runs this site. They just released a new version 1.6 with an updated feature set, but one item we needed was a simple widget to display Google AdSense in the sidebar. To do this, we dove in and made a Widget.
Download it here: AdSense_Widget_1.0.zip (2.22 kb)
Sign up For AdSense
The first task is for you to sign up with Google AdSense and create an AdSense "Unit". This "Unit" is just a description of the ad you want displayed on the site. Once defined, you will be given the code to insert into your site that will display the advertisements. The code will consist of javacript, and will contain variables something like the following:
google_ad_client = "pub-YYYYYYYYYYYYYYYY";
/* MyAd 200x200, created 2/22/10 */
google_ad_slot = "XXXXXXXXXX";
google_ad_width = 200;
google_ad_height = 200;
Install the AdSense Widget
Now that you have an Ad setup with Google, go ahead and install the AdSense Widget. You can download it from the link at the top of this article. The best part of BlogEngine.Net is that installation of widgets, extensions, themes, etc. is a snap!
- Unzip the file which will give you an AdSense sub-folder.
- Copy the unzipped AdSense folder into your blog's \widgets directory. It should end up at \widgets\AdSense
- That's it!
Configuring the Widget to Display your Ad
The final step is to configure your widget and display your Ad. To do this, you must log into the blog as an Administrator and follow the steps below.
- Navigate to the Home page
- Scroll to the bottom of the Sidebar and you will see the widget drop-down box.
- If installed correctly, AdSense should show up in that drop-down box.
- Select AdSense and click the Add button.
- You should now see a blank widget box with Move and Edit links. Click the Edit link to configure.
- A configuration dialog will be presented and offers the following properties:

- Fill out each parameter, matching them to the javascript variables in your AdSense Unit.
- Click Save.
Enjoy your the Sidebar AdSense goodness! Note, if you just signed up for your AdSense account it may take some time before you get real ads displayed.
3911553b-4748-4839-b446-9316f33d2367|9|5.0
Tags: Coding
Coding