google custom search engine doesnt show adsense ads

286 views
Skip to first unread message

Cihan KAZLI

unread,
Sep 24, 2015, 8:50:55 AM9/24/15
to AdWords API Forum

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>    


Anthony Madrigal

unread,
Sep 24, 2015, 9:14:06 AM9/24/15
to AdWords API Forum
Hello,

This forum supports AdWords API. Here is a link to the AdSense API forum. They should be able to assist you there. 

Good luck!

Cheers,
Anthony
AdWords API Team
Reply all
Reply to author
Forward
0 new messages