You get and copy the AdSense code from the Ads page in your AdSense account. How you generate the AdSense code will depend on whether you’re using Auto ads or ad units. Note that for Auto ads you only need the AdSense code, but for ad units you need the AdSense code plus the ad unit code.
How to get and copy the code for Auto ads
To generate the AdSense code for Auto ads you first need to set up Auto ads for your entire site. If you’ve already done this, you can get the AdSense code by following these steps:
- Sign in to your AdSense account.
- Click Ads Overview.
- Click Get code.
- Click Copy code snippet.
Tip: After you’ve copied the AdSense code, the next step is to paste it between the
<head>
and </head>
tags of your page. Learn where to place the AdSense code in your HTML.How to get and copy the code for ad units
To generate the code for ad units, you first need to create an ad unit. If you’ve already done this, you can get the AdSense code and the ad unit code by following these steps:
- Sign in to your AdSense account.
- Click Ads Overview.
- Click By ad unit.
- In the “Existing ad units” table, find the ad unit whose code you want to get.
- Hover over the ad unit and click Get code .
- Copy all of the ad unit code.
Tip: After you’ve copied the ad unit code, the next step is to paste it into the HTML of your page. Learn where to place ad unit code in your HTML.