I have an adsense account and i want to put a google custom searchbox in my web page with my adsense ads.I want to show adsense ads when user make searching something by our google searchbox but i can show search result but i cant show adsense ads. My codes that:
My example page url: http://medyalog.com/test.php
function gcseCallback() {
if (document.readyState != 'complete')
return google.setOnLoadCallback(gcseCallback, true);
google.search.cse.element.render(
{
gname:'gsearch',
div:'results',
tag:'searchresults-only',
attributes:{
linkTarget:' _blank'
}});
var element = google.search.cse.element.getElement('gsearch');
element.execute('koton');
};
window.__gcse = {
parsetags: 'explicit',
callback: gcseCallback
};
(function() {
var cx = 'partner-pub-7424019805974116:9648935074';
var gcse = document.createElement('script');
gcse.type = 'text/javascript';
gcse.async = true;
gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +
'//www.google.com/cse/cse.js?cx=' + cx;
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(gcse, s);
})();
</script>
<div id="results"></div>