Ad code implementation

Create an ad unit

For help using the updated version of ad units, see Create a display ad unit.

To create a new AdSense ad unit that you can manage within your account, follow the steps below:

  1. Sign in to your AdSense account.
  2. Click Ads.
  3. Click Ad units.
  4. Click +New ad unit.
  5. Give your ad unit a name. It’s a good idea to use a unique, descriptive name that will help you find this ad unit later.
  6. In the “Ad size” section, choose the size of the ads that you’d like to show:
    1. We suggest that you leave the “Recommended ad sizes” option selected. If you want to view other ad sizes, select a different option from the Showing drop-down.
      In general, wider ad units perform better. We encourage you to choose one of our recommended ad sizes, which have shown to perform well across a variety of sites. Ad sizes that perform well on mobile are shown with a mobile icon mobile icon.
    2. (Optional) Click Preview if you’d like to see an example of how an ad looks.
    3. Select your desired ad size.
  7. Select which type of ads you’d like to show on your pages from the Ad type drop-down.
    We highly recommend that you display both text and display ads. By displaying more ad types, you can earn more revenue.
  8. (Optional) Apply an ad style for your text ads.
    View details
    Ad styles give you control over how text ads will look on your site. Learn more about choosing the right ad style.
    To apply your text ad style, in the “Text ad style” section, either:
    • Select an existing ad style. Learn more about our predefined ad styles.
    • Edit an existing ad style: select the ad style that you want to edit, click Copy, change the color and font settings, and then click Save. The edited style is saved as a new custom ad style.
    • Create your own custom ad style: click Create new style, choose your own color and font preferences, and then click Save.
  9. (Optional) Set up a custom channel to track your ad unit.
    View details
    Custom channels are an advanced feature that you can use to group specific ad units together and track their performance. Learn more about custom channels. To add a custom channel to track your ad unit, in the “Custom channels” section, either:
    • Select an existing custom channel from the list by clicking the arrow button.
    • Click Create new custom channel, and then in the “Add new custom channel” window that opens:
      1. Give your custom channel a name that clearly describes what types of ad units you are tracking with the channel, and that will help you identify it later. For example, car_pages or blue_skyscrapers.
      2. Choose any additional ad units to track with this channel by clicking the arrow button.
      3. If you'd like this custom channel to appear to advertisers as a targetable ad placement, select the Show this custom channel to advertisers as a targetable ad placement checkbox, and enter the requested details. Or, leave it unchecked to create a custom channel for tracking purposes only.
      4. Click Save.
  10. From the If no ads available drop-down, choose what you’d like us to show in your ad unit if Google has no targeted ads available.
  11. Click Save and get code.
  12. In the "Ad code" box that opens, leave the code type set to "Asynchronous" (the default), unless you want to use synchronous ad code. Learn more about asynchronous ad code.
  13. Copy and paste the ad code into the HTML source code of your pages where you'd like ads to appear. If you're not sure how to do this, you might want to review our Code Implementation Guide.

    Once you've saved your website, ads will appear within a few minutes.

If you need to change the settings of this ad unit in the future, you can edit it from the list of ad units on your Ads page.


Was this article helpful?
How can we improve it?