Integrating with Google


You can build powerful applications that manage Google services such as AdWords. You no longer need to use the AdWords Web management interface. You can build your own application that makes calls into the AdWords service. The Google Data API takes ATOM and RSS to the next level. Find out how to use the GData protocol to create enhanced syndication applications. Create powerful e-commerce applications using the Google Checkout API.

Google AdWords API

The Google AdWords API provides nine basic services that allow you to build powerful AdWords maintenance applications. To get started using the AdWords API, you must first sign up to receive a special token that is included in each of your AdWords API calls to identify you. To receive your token, point your Web browser to www.google.com/apis/adwords/.

Sign in to the AdWords API center, or sign up by clicking the links in the blue box in the upper-right corner of the AdWords API page.

Your applications can do everything from creating new AdWords accounts to listing the performance of certain keywords. The messaging technology used is XML-based technology known as SOAP. Using the AdWords API, you build Web service clients that provide the following services:

  • Account Service: Create and modify Google AdWords accounts.

  • Campaign Service: Create, list, and modify your campaigns including setting the campaign name, its daily budget, and the end date.

  • AdGroup Service: Create and list ad groups, associate ad groups with a campaign, and perform related actions.

  • Keyword Service: Access, modify, and create keywords in an AdGroup.

  • Criterion Service: Create and modify keyword and Web site targeting criteria. You can get the keywords for a keyword-targeted campaign or the Web sites for site-targeted campaigns.

  • Keyword Tool Service: Generate keywords based on a seed keyword or on the words found on a specific Web page or Web site.

  • Creative Service: This lets you create and modify creatives and associate them with an ad group.

  • Traffic Estimator Service: This lets you estimate data, such as the cost per click (CPC), click-through rate (CTR), and average position of your ads.

  • Report Service: Get reports on ad impressions, clicks, and click-through rate.

  • Info Service: This provides basic data regarding the AdWords API usage.

Note 

All the AdWords API calls are sent encrypted using SSL for security purposes.

Visit the AdWords API blog at http://adwordsapi.blogspot.com.

Google Data API

The Google Data API, more commonly called GData, is an XML protocol based on, and extending, the Atom 1.0 and RSS 2.0 syndication protocols. If you need to refresh your memory, you can find more information about ATOM and RSS in Chapter 14.

GData extends these two syndication protocols in a number of ways. For example, neither the ATOM nor the RSS protocol has query ability, while the GData protocol allows queries to be sent. It just wouldn’t be Google without search capability.

The GData protocol also allows for authentication, updates, and something known as optimistic concurrency. For those familiar with database updating, this is similar to transactions. It makes certain that if one person is changing information, and another person changes the information before the first person does, any updates based on the old information are denied.

The authentication preferred by Google when using the GData protocol is known as Authentication for Installed Applications, a Google-specific authentication mechanism. Third-party front-end applications to a GData service should use an authentication mechanism known as Account Authentication Proxy for Web-based Applications.

Session state (the current state of all application variables) is managed in two ways by Google: one through the use of cookies, and the other by sending a query parameter in the URL. It’s recommended that your GData application support one of these two methods of maintaining the session state. Your application still works if you don’t maintain session state, but two round trips to the server are required, which is less efficient.

For the full GData documentation, visit http://code.google.com/apis/gdata/protocol.html.

Google Checkout API

Integrate Google Checkout into your e-commerce Web site to enable customers to easily check out by paying with their credit cards. Your account is automatically updated with their purchases.

Your E-commerce checkout pages host a Google Checkout button. Users click this button, and they see a signup or sign-in page. When users already have a Google account set up with their payment information, they can simply sign in and continue with their checkout. New users can easily sign up. What your users see is shown in Figure 39.3.

image from book
Figure 39.3: Sign up for a Google Checkout account for easy checkout at Google-enabled sites.

The shopper on your site then sees his order detail and can click Place your order now. When checkout is complete, he is thanked for his order and an e-mail copy of the receipt is sent.

You must first sign up for a Google Merchant account. By doing this, you ask Google to process credit card transactions on your behalf, and this is not a free service. As of the writing of this book, you can discount your fees to Google by using an AdWords account; otherwise, each transaction is a percentage of the total sale plus a small per-transaction fee. After logging in to Google, find the current rate at https://checkout.google.com/seller/fees.html.

Signing up for the account is easy. Type a little information about your business Web site, your policies regarding refunds, and your financial information. After you sign up for your Google Merchant account, and are approved, you receive a Merchant ID and a Merchant Key. These are used to identify your transactions and allow you to communicate with Google.

After you have a Google Merchant account, the first step is to begin integrating the Checkout API XML into your shopping cart code. The second step is including a Web service that sends and receives XML messages.

Note 

Google Checkout works with AdWords by displaying a special Google Checkout icon in your ad, letting people know that you want them to spend money on your site (and you use Google Checkout).

Get all the technical documentation for using and integrating the Google Checkout API at http://code.google.com/apis/checkout/developer/index.html.

Google Talk XMPP and Jingle

When you want to create your own client application that talks to the Google Talk service, you need to understand the XMPP protocol in order to program the new client application. The Google Talk service uses an open communications protocol known as the eXtensible Messaging and Presence Protocol. In 1999, Jeremie Miller announced the existence of Jabber, which was an open technology for instant messaging and presence. This later formalized as (IETF) RFC 3920 – RFC 3923. Google has extended XMPP for its own purposes, and documentation for those extensions can be found at http://code.google.com/apis/talk/jep_extensions/extensions.html.

The features in this protocol include:

  • Instant messaging

  • Presence (anybody home?)

  • Media negotiation

  • Whiteboarding

  • Collaboration

  • Lightweight middleware

  • Content syndication

  • Generalized XML delivery

Google Talk also uses a set of XMPP extensions called Jingle. These extensions allow for the creation and maintenance of peer-to-peer communications between clients. This is useful for functionality such as peer-to-peer file sharing or video chatting. When writing your application in C++, a set of C++ components called Libjingle is provided by Google. Use these components to implement Google’s version of Jingle and Jingle Audio for voice communications. Download Libjingle from SourceForge at http://sourceforge.net/projects/libjingle/.

Note 

Libjingle components are offered free under a BSD license agreement.

For more information about XMPP, visit www.xmpp.org.

Google Code Search

Google Code Search is not an API or a protocol, but because this chapter is primarily for programmers and Web developers, the Google Code Search is of particular interest. Search through public source code by launching Google Code Search at www.google.com/codesearch, shown in Figure 39.4.

image from book
Figure 39.4: Search through public Open Source code using Google Code Search.

Search using the Code Search box by typing regular expressions, search strings, special search operators, or a combination of these three. The operators are included in Table 39.1.

Table 39.1: Google Code Search Operators
Open table as spreadsheet

Operator

Description

file: regexp

Search in files matching the regular expression (regexp). For example, file:*jin.c*.

package: regexp

Search in packages identified by the regular expression. For example, package:perl MyFile.

lang: regexp

Search only for code written in a particular programming language. For example, lang:”c++”.

license: regexp

Search only for code protected by a particular type of license. For example, license:gpl.

Figure 39.5 shows the result of a very broad search for all public source code covered under the GPL license. The result includes a code snippet, a link to identical code found in other sources, a link to the actual source code archive, and a link to the license agreement. When the same code is found in several places within a single code source, you see a link to the other locations by clicking the More from link.

image from book
Figure 39.5: See code snippets and links to the license agreements.



Google Power Tools Bible
Google Power Tools Bible
ISBN: 0470097124
EAN: 2147483647
Year: 2004
Pages: 353

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net