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.
- Click Get code.
- Click Copy code snippet.
<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.
- 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.