How do I put adsense ads on my search results page? - javascript

I want to show adsense ads on my search results page.
With Google Custom Search this is easy.
However, I have my own search engine for my site, and I want to show adsense ads on the results page. It doesn't look like this is directly possible.
My thought is to show my own search results, and at the same time call Google's search with the same query in an iframe so I can get the ads and put them in my page. Either in their own iframe, or with JavaScript.
Has anyone done something like this? Do you see any problem with it?

What you want is the Google AdSense API. The only caveat is that you're required to have a minimum of 100,000 daily pageviews. My company uses this API and it's quite easy to do what you're talking about.
If your site has less than the minimum number of pageviews, well, it seems that you're stuck with the options available from standard AdSense.

I think that is what you are looking for "AdSense for Search Ads Only"
http://code.google.com/apis/afs-ads-only/

Related

Search box to search another site

I've been tasked to replicate the search on http://www.hefce.ac.uk/postcode/
in one of our sites and wondered if it's possible to do this by having a search box in our site and every time a user clicks it will pull the results from the HEFCE site and display on ours, or to simply redirect to the HEFCE site with results?
Many thanks!
Well, the easiest thing you can do is just use Google CSE and embed it in your site. It's an easy tool where you can just insert the path of the HEFCE site, and it creates the search engine you need.

Social media functionality on website

Im totally new to integrating social media with a website so this is a bit of a scattershot question. There is no doubt questions on here answering this already but as im not sure what im looking for yet, im not sure how to find them.
Okay so my company wants to promote their twitter and facebook profiles as customer service avenues, so users will ask questions on there rather than calling or emailing.
Ive built quite a funky page promoting this, however the links are literally just links to the facebook and twitter pages.
Is there a method to load a window to twitter or facebook from a website link that will prompt a user to type and submit a question to be submitted the the FB/twitter feed? Or is there a way to take content from a text box on site and pass this through to FB/Twitter?
Basically just looking for something slightly cooler and more user friendly than just dumping them on the companies FB or twitter page on click.
Cheers,
Found the solution I was looking for that works for twitter, its simply passing values through a URL, details are here https://about.twitter.com/resources/buttons#mention.
For facebook, seem to be able to do this through the comments module. Seems like a lot of this can be edited through the API so a combination of both should give me what i need:
https://developers.facebook.com/docs/plugins/comments/
use this website as an idea on pushing content into tweets
http://www.sharelinkgenerator.com/
example for twitter: the href on your link would be:
https://twitter.com/home?status=your%20content%20here
if you wanted dynamic content, you would build the url using script.
same rules apply for facebook.
if you wanted to keep it within your website, maybe look into a fixed position div containing an iframe.

How to update table value from Google search result

So I was challenged to make a table that its value is based on search result from Google. I was tasked with three things that's totally new for me:
For example, I have the name of Barrack Obama and Abraham Lincoln, when I click on Barrack Obama, the table (with three columns: Number, Page Title, and URL) will be updated according to the Google search result of "Barrack Obama" and when Abraham Lincoln is clicked, the table will be updated again accordingly.
I was asked to make the table changeable, must able to swap columns, resize, order it by ascending or descending.
and finally, when I click on the URL or any of the list, the result page could appear on the same page (on a reading panel, a different section from the table but still on the same page, let's say it's on the right side section of a webpage), and should be resize-able as well
Can somebody give me a pointer or clue on where should I start looking or doing? I was only given clue as using JSON, Jquery, or Google API, but I don't quite sure of the specifics. Any help is appreciated, sorry for the multiple question, I had to since it was related in some way (I think). Thank you for the response!
Google does not have an API for their search results, but here's the general flow of logic:
You will need to make a GET AJAX request using XMLHttpRequest or jQuery on a Google search URL. Do some playing around with Google searches and you can see how they format them:
https://www.google.com/?#q=barack+obama
On the returned HTML page, you should parse out the results and set your table data. Again, play with the Google search results page and see how it's formatting.
For #3, the returned HTML object can be embedded in something like an iframe to give the user a reading panel.
For resizing, there aren't any default HTML tags that will resize like a split pane. If you decide to go with jQuery, you could look at the jQuery UI or other widgets that give you the resizing functionality you'd like.

Loading and running an external webpage

I have been asking this question in different places but couldn't get a real answer.
Here is the problem:
Let say I have a web page which is going to serve like google. I mean it will use google at the bacground but foreground will be my page. It will contain a textbox and a button. So a user will come and enter a text that he wants to search and click the button to submit the query. So my webpage will transfer this search text to the google at the background and search the thing in google. It will return the results to my webpage in a different form. `
So the question is, what is the best way of implementing this and more importantly is it possible.
Many thanks.
You will have to use Google Custom Search API: https://developers.google.com/custom-search/v1/overview
You cannot use classic web crawler techniques to get the data from Google since that violates their TOS.

How to get the number of time a user visit a page?

Does anyone have any idea about how to get the number of time a user visit a particular site? For instance, if you do a search on google and there's a link that you clicked already, google will tell you how many times you have visited that particular link. Any ideas on how to code something like that using javascript?
Thanks.
In Google's case they can track that you have clicked on a link. Its a specific action that they can attach a javascript listener to. If you want to do the same thing on your own site, you can add some javascript that does something similar, and anytime a link is clicked an AJAX call can be made that will allow you to track that it was clicked.
However, if you are just looking to get some basic stats about pages on your site you can add Google Analytics to it, and it will gather a large amount of useful data for you.
http://www.google.com/analytics/
If you want to know how many people are visiting your page, you probably want to check out something like Google Analytics rather than making it yourself. It will give you a lot of data that you'd have to make a lot of effort to gather yourself.

Categories

Resources