Prev | Current Page 368 | Next

David Berube

"Practical Reporting with Ruby and Rails"

The company wants you to create a Rails application
that lets the user specify a target number of clicks for the ad campaign, regardless
of the language advertised, and returns a list of the cheapest ads to achieve that many
clicks.
You??™ve retrieved the Google report on the past performance of the ads (Listing 13-1).
The catch with the reports generated by Google is that results greater than 100MB can be
retrieved only in XML format. A sizable campaign could conceivably exceed that limit. To
be prepared, you??™ll parse the XML version, so you won??™t need to change input formats if
the size of your results changes. After you??™ve retrieved that result, you can analyze it and
then determine the cheapest ad mixture to meet your target number of clicks.
Loading the XML into a Database
Listing 13-2 shows the script that loads the report XML into a MySQL database. You??™ll
need Active Record and Hpricot (introduced in Chapter 6) installed to use this script.
You can install Hpricot with the following command:
gem install hpricot
CHAPTER 13 n TRACKING YOUR ADS WITH GOOGLE ADWORDS 267
You??™ll also need MySQL installed and a blank database named text_ad_report set up.


Pages:
356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380
James Morrison sennik Rok 2001 / MMI ochrona kreskowka