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:
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:
- Sign in to your AdSense account.
- In the left navigation panel, click My ads.
- Click Auto ads.
- On the "Auto ads" page, click Set up Auto ads.
- In the "Set up Auto ads on your site" box, click Copy code.
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:
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:
- Sign in to your AdSense account.
- In the left navigation panel, click My ads.
- Find your ad unit in the list of ad units, and click Get code.
- 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.
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.
- Select the ad code by clicking it. You'll see the ad code highlighted in blue.
- Copy all of the ad code, e.g., press Ctrl+C (Windows) or ⌘+C (Mac).
- Leave the code type set to "Asynchronous" (the default), unless you want to use synchronous ad code. Learn more about asynchronous 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: