Code implementation guide

Get and copy the ad code

To generate your AdSense ad code you first need to create an ad unit. You do this on the My ads tab in your AdSense account. There are a few different types of ad unit that you can choose from. Once you've decided which type of ad unit you want to create, follow the steps below to get and copy your ad code.

Ad unit: A set of Google ads displayed as a result of one piece of AdSense ad code.

Types of ad unit

AdSense offers several different types of ad unit. If a standard ad unit doesn't meet the requirements of your site, consider using one of our more specialized ad units:

How to get and copy your ad code

In the sidebar, select your product. For example, if you want to display ads on your website, select "Content".

Click +New ad unit.

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.

In the "Ad size" section, choose the size of the ads that you’d like to show.

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 .

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.