BuySellAds Content Portal

Installing Your Ad Code

Last Updated on December 29, 2015

All Ad Code things can be found throughout this document. Installing, configuring, and tweaking our ad code to meet your needs requires a little technical know-how, but the short tutorials below should expedite the customization process for you enough to make it as simple as tweaking a few things here and there.

How to Install Your Ad Code

After you create an ad zone, the next thing you will need to do is install the ad code so that any ads that you sell can start appearing on your website.

Login to your account and go to Publishers > Dashboard by hovering your email address in the top-right corner. Then click on the “Actions” button for your zone and select “Ad Code” from the drop-down menu.

On this page, you will see the snippets of code that you will need to paste into your website as well as the settings for your zone. For this step, you will copy the STEP 1 Main Code and paste it into your site just below the opening tag of your website. If you are using a WordPress theme, the opening tag may be included in a file within your theme’s files called header.php or something similar.

It is very important that the STEP 1 Main Code is in the proper place in your website and that it appears only once on each page. If the STEP 1 Main Code is not at all present in your site or if it is duplicated in a page, your ads will either not appear at all or will not display properly. You can think of this as the ‘engine‘ that drives your ads. Without this code, your ads will not work.

Below is a screenshot of where the STEP 1 Main Code is placed in a sample site. It is also important to paste the code directly below your opening tag with nothing in between.

Next you will paste the STEP 2 Zone Code wherever you want that zone to appear in your website. For example, if you want this ad zone to appear in your sidebar, then you will find the file in your website that contains your sidebar code and paste the code where you want the ad zone to appear. If you are using a WordPress theme, this file may be an include file within your theme’s files called sidebar.php or something similar to that. Or if you want your ad zone to appear in your header, then you may need to open a file called header.php or something similar. It is important that you install this code as soon as you can. Your zone will not be available for sale on your public ad page until a few hours after your ad code is installed properly and tracking impressions.

Below is a screenshot of where the STEP 2 Zone Code is placed in a sample site. You will want to paste this code exactly where you want your ads to show up in your site.

If you are not familiar with your website’s files, you may need your web designer to help you install the code. Or if you are using WordPress, you can try using our Official WordPress Plugin. We usually prefer that you install our code manually to avoid issues with the plugin in themes that are not programmed accurately, but it is a good option to try if you feel more comfortable installing the code this way.

Next you will scroll down the to the “Display Settings” area. Here you will make decisions about how your ads will appear within your zone.

Show Ad Here

When you check this box, you are turning on the option to show placeholder “Advertise Here” banners that will link to your Ad Detail page so potential advertisers visiting your site can find out about your available ad spaces. It is usually best to keep this option on since that is how many potential advertisers will find out about your available ad space.

Repeat Ad Here

When you check this box, you are turning on the option to show the “Advertise Here” banner for all of the available ads in that zone. So if you have 4 banners in this zone and you check this box, you will see four “Advertise Here” banners where those ads have not been sold yet. As ads are sold, those will be replaced by the real ads. By default and without this checked, only one “Advertise Here” banner will show in your zone at a time as long as you have at least one ad available to purchase. So in this case, if you have one banner sold, and this box is not checked, you would see the real banner for the ad that was sold and just 1 “Advertise Here” banner instead of three “Advertise Here” banners.

No Styles

Checking this will remove all pre-defined styles from your ad zone, so if you remove this, you will want to be sure that you ad styles to your own stylesheet for the ads to appear properly on your site.

Vertical: By default, our system floats ads to the left using CSS. This is the default setting because this is the way that many ads are displayed by our publishers. But in some cases, a publisher does not want an ad to float to the left – primarily if the ads in that zone are in a vertical column or if there is just 1 ad in a zone. It is always best to check this box for an ad zone that contains only 1 ad or that has 1 column of ads displayed vertically. When this setting is turned on, the system removes the ‘float:left;‘ style and your ad(s) should display properly.

The “Style Settings” section allows you to edit the CSS for this ad zone if you wish to edit the margins of your ads, etc. You should only edit this area if you are familiar with editing CSS. If you are not familiar with editing CSS, it may be best to have your web professional edit these settings or send a request to our Support Department outlining what it is that you wish to edit so that we can assist you.

Anchor Style

Editing this field will apply styles to the anchor tag for each ad in this zone. So if you are editing the margins between your ads, you will want to edit that here.

Image Style

Editing this field will apply styles to just the image of your ad. In most cases, you will leave the CSS in this field the way it is and just apply your CSS to the “Anchor Style” field above.

Ad Here Style

Editing this field will apply styles to the “Advertise Here” banner that appears within this zone. So if you want this to be a different color than the gray box, you would change that color by editing “background:#e7e7e7;” and changing “#e7e7e7” to the color of your choice.

Ad Here Hover Style

Editing this field will apply styles to the hover state of the “Advertise Here” banner in this zone. So if you want the “Advertise Here” banner to be a different color during the hover state, you would change that color by editing “background:#ddd;” and changing “#ddd” to the color of your choice.

I hope this helps as you go through the process of installing your ad code. Please be sure to submit a Support Ticket if you need help at anytime during this process. We are always happy to help. 🙂

Do I have to keep the ad code installed at all times?

That is correct. The ad code will need to be installed and remain installed for our system to be able to count impressions for the estimates. An ad zone will not display for sale until at least 2,000 page impressions per month have been counted from the zone.

I can’t find / access the opening body tag in my website. Does the Step 1 code have to be installed there?

We have specific installation instructions in place to avoid possible conflicts with other scripts, which is why we require the Step 1 code to be installed just beneath the opening tag of your website. Having this installed in the wrong location can cause ad display problems in several browsers and may lower the impression counts that we estimate from the code installed on your website.

Normally, the opening tag is found in a header file or similar. This file may be called something like header.php or head.php – although this will also depend on how your website’s files are setup. If you are still unable to find where you can access this tag in your files, you may need to contact your theme/template developers or website designer to find out how to access this tag to install our Step 1 code.

I installed the ad code, but the ads are not appearing on the site.

There are a few reasons why this might be happening. Here are some things to check for:

  • By default, you should see at least one “Advertise Here” banner where the ad zone code is installed. If you do not see this banner, it may mean that the “Show Ad Here” option is unchecked on the “Install Ad Code” page for that zone. If you want to show an “Advertise Here” banner, you will just need to check the “Show Ad Here” option on the “Install Ad Code” page.
  • Please make sure that you have both the STEP 1 and STEP 2 ad code installed on your site and in the correct locations. The STEP 1 code should only appear after the opening body tag of your website and the STEP 2 code should appear where you want the zone to show up on your site. Your ads will not appear if both the STEP 1 and STEP 2 code is not installed.
  • Make sure that your STEP 1 code is not duplicated on your site. It should only appear once in your code. If the STEP 1 code appears more than once in a page, your ads will not display properly.
  • You will want to make sure that your ad code is appearing on your live site. To do this, click on “View > Source” in your browser to view the live source code of your site. Make sure that your STEP 1 code is appearing just after the opening ‘BODY’ tag and that your STEP 2 zone code is where you want the ads to appear in your site. If you do not see both of these snippets of code, but you are sure that you installed it, then you will want to make sure that you edited the correct files and that you uploaded those files to your live web server. If you are using WordPress, there are some website optimization plugins that can strip our code from the live site during optimization, so you will want to check for this as well.

If you have tried the solutions above, and you still cannot see the ad zone on your site, please open a support ticket, and we will be happy to help.

I believe that my ad code is installed correctly, but your code checker says it is not correct.

Sometimes our code checker can be more sensitive to some sites than others when checking to see if your code is installed correctly. This message will also appear if you do not have your ad code installed on the main / home page of your site.

The best way to determine if your code is installed correctly is to make sure that your STEP 1 code appears just below your opening tag with nothing else in between. Then your STEP 2 zone code should be placed in your site where you want that zone to appear.

If you have done these things and your code is on your live site, and then it means it is installed correctly. If you are still in doubt, just open a Support Ticket and we will check this for you to be sure. 🙂

Can I install the same STEP 2 zone code twice in the same page?

Yes*. In some cases, you may want to display the same zone twice in a page. For example, you may want your 728×90 zone to appear in both the header and the footer of your site instead of creating separate zones for this. This means that an ad purchased in that zone will appear at both the top and bottom of the site.

You should not duplicate the STEP 2 code exactly, as that can cause impression counts to be off and also cause ad display issues. To do this correctly, you will just need to add “_1” and “_2” after the “bsap_1234567” part of each zone to differentiate them.

So it will look like this:


*Note: If you are using BuySellAds Unreserved, then you will not be able to display the same zone more than once on a page.