Get and copy the ad code

You get and copy ad code from the Ads page in your AdSense account. How you generate your ad code will depend on whether you're using Auto ads or ad units.

How to get and copy your ad code

Select an option below and follow the instructions to get and copy your ad code:

Auto ads

To generate your ad code you first need to set up Auto ads for your entire site. If you've already done this, you can get the ad code for Auto ads by following these steps:

  1. Sign in to your AdSense account.
  2. Click Ads.
  3. On the "Auto ads" page, click Set up Auto ads.
  4. In the "Set up Auto ads on your site" box, click Copy code.

    Auto ads code box

What to do next

After you've copied your ad code, the next step is to paste it between the <head> and </head> tags of your page. For help with this step, see the following resources:

Ad units

To generate your ad code you first need to create an ad unit. If you've already created an ad unit, you can get your ad code by following these steps:

  1. Sign in to your AdSense account.
  2. Click Ads.
  3. Click Ad units.
  4. In the "Existing ad units" table, find the ad unit whose code you want to get.
  5. Hover over the ad unit and click Get code Embed.
  6. Copy all of the ad code. 

What to do next

After you've copied your ad code, the next step is to paste it into the HTML of your page. For help with this step, see the following resources:

Was this helpful?
How can we improve it?