You obtain and copy the AdSense code from Ads page in your AdSense account. How you generate the AdSense code will depend on whether you use automatic ads or ad units. Note that for automatic ads, you only need the AdSense code, but for ad units, you need the AdSense code and the ad unit code.
How to obtain and copy the code for automatic ads
To generate the AdSense code for automatic ads, you must first set up automatic ads for the entire site. If you have already done so, you can obtain the AdSense code by following these steps:
- Sign in to your AdSense account.
- Click Ads
global vision.
- Click Get code.
- Click Copy code snippet.
How to obtain and copy the code for ad units
To generate the code for ad units, you first need to create an ad unit. If you have already done so, you can obtain the AdSense code and the ad unit code by following these steps:
- Sign in to your AdSense account.
- Click Ads
global vision.
- Click By ad unit.
- In the “Existing ad units” table, find the ad unit whose code you want to obtain.
- Hover over the ad unit and click Get code
.
- Copy the entire ad unit code.