Once you’ve created a Google Adsense Ad Unit you need to place the code somewhere on your website. The easiest place to do this is in a sidebar, header or footer widget. Depending on what theme you are using you’ll have at least one of these that you can use. This blog post takes you through the steps to add a Google Adsense Ad Unit to a widget. We’re going to use a sidebar widget as it’s the most common one.

1. Get your Google Adsense Unit Code

Log in to your Adsense account and go to the Ads section. Look for Ad units.

AdSense Ad Units


You will see a list of your ad units here. Find the one that you want to add to your website and use the ‘Get Code’ link to see the code fragment you need to use.

Google Adsense Ad Unit Get Code



Now copy the contents of that box.

AdSense Ad Unit Code Fragment



2. Add A New WordPress Widget

Go to your WordPress dashboard and look under Appearance -> Widgets to see what widget areas are available for you to use.

Widgets section


Alternatively you can go to your theme customiser and edit the widgets on the front end.

Appearance Customize


Whichever way you access the widgets, you want to add a new custom html widget and copy the code fragment into it.

Custom HTML widget

Drag the Custom HTML box into the sidebar section.


Copy the code fragment into the box – it’s optional to give it a title.

Google Adsense Custom HTML Widget


Make sure that you save your changes as you go along.

Save Widget



3. View the resulting Ad

Now go to a page on your website where that sidebar displays eg. a blog post, and you should see an ad being displayed within the next hour. If this is your first ever ad unit it may take a bit of time before an appropriate one is found for your website.

Google Adsense Ad Unit displayed in a widget


At this point the ad unit is now active. If it’s a new add then the status will change from new to active after several days. You can view the performance of your advertisements in the Google Adsense Dashboard and also go back and edit them to make changes.