Let me explain what I'm trying to achieve.

I have tried this little snippet of code that implements Google search on my private website:

<div class="gcse-search"></div>
<script async src="https://cse.google.com/cse.js?cx=[some_id]:[number]"></script>

It creates a nice search box on my site with very little involvement, that looks like this:

enter image description here

[some_id]:[number] comes from Google console. I had to prove ownership of the site, and specify which pages on it I want to be searched, after which it generated those unique keys.

The problem is that it displays ads on top of the search list.

So I did some searching and found this page (3rd option from the left) that (I think) said that I can remove ads by paying $5 for 1,000 searches or something of that nature. (Sorry, it's all very confusing.)

OK, so I went to my Google console and got an API key. It said that I need to add it to the URL, so I did it as such:

<div class="gcse-search"></div>
<script async src="https://cse.google.com/cse.js?cx=[some_id]:[number]&key=[my_key]"></script>

But it didn't take away the ads.

So what am I doing wrong?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.