Sunday, March 15, 2009

Changes to the GoogleBar

As many of you already know, developers can use the GoogleBar control in the Maps API to allow users to search the map for local businesses, landmarks and points of interest. As part of Google's ongoing commitment to improve user and developer experience, we have some changes coming up for the humble GoogleBar. Most importantly, we are adding advertising targeted to the user's searches. We hope that this, as with all Google advertising, will improve the user experience by providing targeted and relevant sponsored results. You will benefit from this as well, as you can make money from these Google ads provided on Maps API sites (see below).

In addition, there are a number of smaller changes: The JavaScript underlying the GoogleBar has been completely rewritten and the UI has been updated to make it more accessible and easy to use. In its collapsed state, the original GoogleBar control was often missed as a functioning search bar, so we aimed to design a new GoogleBar that was as recognizable as the traditional, elegant Google search field (logo + field + button), while occupying minimal space on the map. You can see the new GoogleBar, together with ads, below:


As you can see, in addition to the ad, there have been several cosmetic improvements. For example, we've removed the magnifying glass so the control is open all the time. As a result, we are deprecating the showOnLoad argument within the GoogleBarOptions object. All other arguments continue to be supported. This is a substantial change to the experience, look and feel of the GoogleBar, so we are giving you the opportunity to try the new version and give us some feedback before it becomes the default setting. Starting today you can try out the new GoogleBar by passing the parameter style='new' as part of GoogleBarOptions, as long as you are using the latest version of the API.

For example:

var opts = {
 googleBarOptions : {
   style : 'new'
 }
}
map = new GMap2(document.getElementById("map"), opts);
map.setCenter(new GLatLng(33.956461,-118.396225), 13);
map.enableGoogleBar();

Full documentation of the GoogleBar's new features is available in the API documentation.

This new version of the GoogleBar will contain advertising, as shown above. If you want to profit from the advertising personally, then all you have to do is get a Google AdSense for Search (AFS) id and pass it into the GoogleBar constructor. If you don't yet have a Google AdSense account, sign up for an account. Once you have done so (or if you already have an account) make sure you've also enabled the account with AdSense for Search. Once you have an AdSense for Search account, you will receive an AFS client ID. Specify this client ID, as shown below, and you will begin receiving advertising revenue for any clicks on sponsored results within your API application.

var opts = {
 googleBarOptions : {
   style : 'new',
   adsOptions : {
     client : ####  // Your Google AdSense for Search (AFS) client id
   }
 }
}
map = new GMap2(document.getElementById("map"), opts);
map.setCenter(new GLatLng(33.956461,-118.396225), 13);
map.enableGoogleBar();

Optionally, you may also specify an AdSense for Search channel if you've set that up. More information on advertising channels is located in the AdSense Help Center. Additionally, you may also specify the Ad Safety Level to associate with your advertising and the language in which to display results. Please consult the Maps API Reference for specifics.

You can give us feedback by going to the Maps API Google Group. A month or so from today we are planning to change the default style of the GoogleBar to be the new and improved version, so stay tuned for further announcements.