How to add Google AdSense to the White Label

This article describes how to place the Google AdSense code in White Label search results.

Open your AdSense account and create an ad.

You'll get a code like:

<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<ins class="adsbygoogle"
style="display:inline-block;width:728px;height:90px"
data-ad-client="ca-pub-0515363181603345"
data-ad-slot="8813803962"></ins>
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>

Go to the White Label settings and place the next part of the code in the Meta tab:

<script async='async' src='//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js'></script>
<style>.adsbygoogle { text-align:center;margin-bottom:20px;display:inline-block;width:728px;height:90px}
#ad_top_container { text-align:center;}</style>

Note: the ad_top_container tag is responsible for placing the banner above the search result. If you replace it on ad_bottom_container, the banner will appear below the search results.

Go to the Footer tab and place this code there:

<script>
setTimeout(function(){ var div = document.createElement("ins");
div.setAttribute('class', 'adsbygoogle');
div.setAttribute('data-ad-client', 'GOOGLE-DATA-AD-CLIENT');
div.setAttribute('data-ad-slot', 'GOOGLE-DATA-AD-SLOT'); document.getElementById('ad_top_container').appendChild(div); var js = document.createElement("script");
js.setAttribute('src', 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js');
js.setAttribute('async', true);
document.head.appendChild(js); setTimeout(function(){
(adsbygoogle = window.adsbygoogle || []).push({});
}, 1000); }, 3000);
</script>

Replace GOOGLE-DATA-AD-CLIENT on  the value of the data-ad-client attribute, and GOOGLE-DATA-AD-SLOT on the value of the data-ad-slot attribute from your ad code.

Save the changes. Now the Google AdSense ad will appear in the search results.

Tip: To remove an ad from the White Label home page, add a check for the TPWL-widget-front_page class.

Was this article helpful?

Have more questions? Submit a request