3/22/2022»»Tuesday

Adsense Ad Slot Id

3/22/2022
    65 - Comments

Google Adsense allows your to specify the width and length of Adsense advertisements for each slot and gives you the code you need to run the advertisements. However, since the width and length are fixed once the code is pasted, it does not work with responsive websites out of the box. Slot Id Slot id defines AdSense visual elements of your ad unit. After you create a new AdSense unit with the current Google Adsense generator, it is embedded inside the code. Slot id stores color, size, font & corners options.

If you’ve met the requirements of AdSense Consent Policy and you want to serve non-personalized ads to all users located in the European Economic Area or the UK who visit your site, no changes to your ad tagging are needed.

You can enable non-personalized ad serving in the AdSense or Google Ad Manager UIs.

However, if you have specific requirements, for example, you want to serve some users personalized ads, and other users non-personalized ads, you might want to consult the examples below.

Note that the following code samples are not working examples. They’re meant as hints to show how you can implement ad personalization settings.

Ad code for non-personalized ads

If you’d like to serve non-personalized ads on a per page basis, consult the example below:

<html>
<head>
<title>Your site title</title>
</head>
<body>

<script async src=”https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script>
<script>(adsbygoogle=window.adsbygoogle []).requestNonPersonalizedAds=1;</script>
// The line above makes sure you are requesting non-personalized ads. It needs to come before you use <script>(adsbygoogle = window.adsbygoogle []).push({});</script> and it suffices to have one such line per page.
<!– One test unit for GDPR –>
<ins class=”adsbygoogle” style=”display:inline-block;width:970px;height:250px”
data-ad-client=”ca-pubxxx”
data-ad-slot=”slot_id”>
</ins>

<!– Another test unit for GDPR –>
<ins class=”adsbygoogle” style=”display:inline-block;width:250px;height:250px”
data-ad-client=”ca-pubxxx”
data-ad-slot=”slot_id”>
</ins>
<script>(adsbygoogle = window.adsbygoogle []).push({});</script>
// This triggers the ad request.

</body>
</html>

Ad code for personalized ads

If you want to serve some users personalized ads, and other users non-personalized ads, consult the example below:

<html>
<head>
<title>Your site title</title>
</head>
<body>

<script async src=”https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script>
<script>(adsbygoogle=window.adsbygoogle []).pauseAdRequests=1;</script>
// This will pause ad requests, so users have time to interact with your consent solution.

/* Set up the consent solution and act according to the user choice.

Adsense ad slot idea

If the user declines personalized ads, make sure to call (adsbygoogle=window.adsbygoogle []).requestNonPersonalizedAds=1;
Remember that you need user consent for using cookies even for non-personalized ads in countries where the EU eprivacy directive requires it.

Later, you can call (adsbygoogle=window.adsbygoogle []).pauseAdRequests=0 to resume sending ad requests. Without making this call, no ads will be shown.

*/

<!– One test unit for GDPR –>
<ins class=”adsbygoogle” style=”display:inline-block;width:970px;height:250px”
data-ad-client=”ca-pubxxx”
data-ad-slot=”slot_id”>
</ins>

<!– Another test unit for GDPR –>
<ins class=”adsbygoogle” style=”display:inline-block;width:250px;height:250px”
data-ad-client=”ca-pubxxx”
data-ad-slot=”slot_id”>
</ins>
<script>(adsbygoogle = window.adsbygoogle []).push({});</script>
// This usually triggers the ad request, but you have paused these.

Adsense

Adsense Ad Slot Ideas

Adsense

</body>
</html>

Auto ads: ad code for non-personalized ads

If you’d like to serve non-personalized Auto ads on a per page basis, consult the example below:

<html>
<head>
<title>Your site title</title>
<script async src=”https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script>
<script>
(adsbygoogle=window.adsbygoogle []).requestNonPersonalizedAds=1;
(adsbygoogle=window.adsbygoogle []).push({google_ad_client: “ca-pubxxx”, enable_page_level_ads: true});
</script>
</head>
<body>

</body>
</html>

Auto ads: ad code for personalized ads

If you want to serve some users personalized Auto ads, and other users non-personalized Auto ads, consult the example below:

<html>
<head>
<title>Your site title</title>
<script async src=”https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js”></script>
<script>
(adsbygoogle=window.adsbygoogle []).pauseAdRequests=1;
// This will pause ad requests, so users have time to interact with your consent solution.
(adsbygoogle=window.adsbygoogle []).push({google_ad_client: “ca-pubxxx”, enable_page_level_ads: true});
// This usually triggers the ad request, but you have paused these.
</script>
</head>
<body>

<script>
/* Set up the consent solution and act according to the user choice.

If the user declines personalized ads, make sure to call (adsbygoogle=window.adsbygoogle []).requestNonPersonalizedAds=1;
Remember that you need user consent for using cookies even for non-personalized ads in countries where the EU eprivacy directive requires it.

Later, you can call (adsbygoogle=window.adsbygoogle []).pauseAdRequests=0 to resume sending ad requests. Without making this call, no ads will be shown.

*/
</script>

Adsense Ad Slot Idea

Slot

</body>
</html>