Many users asked me how they could place an ad into the upper part of their website. This article should cover all the options you currently have with Advanced Ads.

What is the website “header”?

It depends on your theme what the header really is, but one could say that it is the upper visible part of your website that doesn’t change (much) on all pages. It often contains a logo or navigation. For wpadvancedads.com, I would consider the green highlighted area on the screenshot to be the header.

website header

 

“header” vs. “head”

You might sometimes need to place an ad code into the “head” part of your website. This shouldn’t be confused with the “header”. The “head” is the invisible part at the top of your website’s source code and no place for visible ads. Some ad networks or servers like DFP need to place code there that pre-loads content that is displayed later.

ads in the header

Methods to place an ad into the header

These are the basic methods to put an ad that is managed with Advanced Ads into the header:

  1. PHP function / Manual Placement
  2. Theme option
  3. Custom Position placement
  4. Genesis placements
  5. Sticky Header Bar

1. PHP function / Manual Placement

If you are familiar with PHP and know how WordPress themes are working, you can place the ad manually into the header of your site.

You can either use the function for an ad the_ad(), a group the_ad_group(), or a placement the_ad_placement().

I personally prefer to use the Manual Placement, because once you set it up, it can stay there forever and you can change the ads or group that should appear there from your dashboard, without touching the source code ever again.

To use the Manual Placement go to Advanced Ads > Placements and create a new placement with the type that is represented by the following image:

manual placement

Choose a name that helps you remembering where you are going to place the ad and choose the ad or group that should be displayed, if you created it already.

Now, open the template file with the header code in it. This is very likely the header.php file in your theme folder. From there on you must find your way to the position in the code where you want to place the ad.

You can get the PHP code for the placement by clicking on the show usage link on the placement page. However, I prefer the following extended version of that code to make sure that it doesn’t break your site if Advanced Ads is not available:

Be sure to replace the second line with what you find below the show usage link on the placement page.

Save the template file and you are ready to make use of this placement.

Child Themes

One problem you might run into with this method are updates of your theme. When you replace the changed file with a new version, your changes will be lost. So if possible, create a child theme for such manual changes.

2. Theme option

There are many themes out there which already provide basic ad placements and options to put content into a predefined position in the header.

This varies a lot from theme to theme, so I can only give general advice here.

Most important is to check, whether these fields accept shortcodes or PHP functions. If they accept shortcodes, create a Manual Placement like described above. Instead of using the PHP function that you find below the show usage link, get the shortcode and place it in the theme option for the header.

If your theme accepts PHP code, but not a shortcode, use the PHP code from above. However, using the shortcode should always be the preferred choice.

3. Custom Position placement

The Custom Position placement lets you choose any position in your theme for your ads. It is the best way if you want to be most flexible and are not experienced with coding. It also works after theme updates.

This placement comes with Advanced Ads Pro and has this symbol:

custom ad position placement

There is a dedicated page in the manual which also includes a video on how to use this placement:

Custom Position placement

4. Insert ads into Genesis Theme header

Many publishers are using the Genesis theme framework or a child theme built on top of this. The Genesis theme comes with many hooks that allow you to insert content on very different positions.

However, not all child themes offer an interface to make use of this, so I wrote the Genesis placement add-on.

This add-on offers a placement that allows you to target the hooks. There are a few header positions included too, which you can test in order to move your ad to the correct position.

When choosing this option to place the ad in your websites header, just look out for this placement symbol:

Genesis logo

5. Sticky Header Bar

A very prominent and visible position to place an ad into the header of your website would be a sticky bar at the top of your site. This placement is above the other content and can scroll with the rest until closed by the user. It has the best performance data from all positions.

With our Sticky add-on you can create such an ad. Just look out for this placement:

sticky header bar

Is the header a good ad position?

Finally, I would like to share my opinion as a publisher and consultant about the header position with you.

If you are using performance based ads (where you get paid for clicks or other actions), the header position is a sub-optimal placement. The reason is simply that people are interested in the content of your site, not the header. They also quickly learn which elements are there and don’t look at this position anymore. An exception from this is the method given in #5 on the list above.

If you work with AdSense and check the active view stats, you might even find that this metric, showing how many times the ad was visible for a second, is quite low. The reason is that people quickly scroll down to see the real content. The smaller the device, the shorter the time spend on the header is.

The more new visitors you have, the better the performance of the header ads might actually be. It is also a good position for internal ads or the ones that don’t need to be clicked in order to earn you money. In fact, some ad networks like their ads there too, despite the rather low performance.

You're using WordPress and would like to get Advanced Ads for free?