Search
Clear search
Close search
Google apps
Main menu

Code implementation guide

Get and copy the ad code

You get and copy ad code from the My 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. In the left navigation panel, click My ads.
  3. Click Auto ads.
  4. On the "Auto ads" page, click Set up Auto ads.
  5. 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. In the left navigation panel, click My ads.
  3. Find your ad unit in the list of ad units, and click Get code.
  4. In the "Ad code" box that opens:
    1. Leave the code type set to "Asynchronous" (the default), unless you want to use synchronous ad code. Learn more about asynchronous ad code.
      If you've chosen to create a responsive ad unit, you won't see the Code type drop-down in the "Ad code" box. Responsive ad units only use asynchronous ad code.
    2. Select the ad code by clicking it. You'll see the ad code highlighted in blue. Example of the "Ad code" box
    3. Copy all of the ad code, e.g., press Ctrl+C (Windows) or ⌘+C (Mac).

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 article helpful?
How can we improve it?
false
Sign in to AdSense

Sign in to AdSense to see help for your account Don't have an AdSense account? Sign Up for AdSense!