Where to place the AdSense code in your HTML

After you’ve generated the AdSense code, you need to paste it between the <head> and </head> tags of your site. We recommend you place the AdSense code on every page across your site to get the most out of AdSense.

Tip: WordPress user? Get help with adding AdSense code.

The following examples show you where to place the AdSense code:

Example HTML page before the AdSense code has been added

<html>
<head>
This is the head of your page.
<title>Example HTML page</title>
</head>
<body>
This is the body of your page.
</body>
</html>

Example HTML page with the AdSense code added in the <head> tag

<html>
<head>
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-1234567890123456" crossorigin="anonymous"></script>
This is the head of your page.
<title>Example HTML page</title>
</head>
<body>
This is the body of your page.
</body>
</html>

Note: This is sample code only, please don’t use it in your own site’s code.

Leave a Comment