Google::Adwords::AdService - Interact with the Google Adwords AdService API calls
This documentation refers to Google::Adwords::AdService version 0.3
use Google::Adwords::AdService; use Google::Adwords::Ad; use Google::Adwords::Image; use File::Slurp; my $adgroup_id = 20048; # Create Text Ad my $ad1 = Google::Adwords::Ad->new ->adType('TextAd') ->headline('The World is Flat') ->description1('Yes') ->description2('It is') ->adGroupId($adgroup_id) ->destinationUrl('http://aarohan.biz') ->displayUrl('aarohan.biz') # Create an Image Ad my $ad2 = Google::Adwords::Ad->new ->adType('ImageAd') ->adGroupId($adgroup_id) ->destinationUrl('http://aarohan.biz') ->displayUrl('aarohan.biz'); # The image stuff my $image_data = read_file('picture.jpg'); my $image = Google::Adwords::Image->new; $image->name('picture.jpg'); $image->data($image_data); # Associate the image with the Image Ad $ad2->image($image); # Create the AdService my $service = Google::Adwords::AdService->new(); # login details $service->email('email@domain.com') ->password('password') ->developerToken($developer_token) ->applicationToken($app_token); # if you use a MCC #$service->clientEmail('clientemail@domain.com'); # or #$service->clientCustomerId('xxx-xxx-xxxx'); # Add the two ads my @added_ads = $service->addAds($ad1, $ad2);
This module provides an interface to the Google Adwords AdService API calls.
Make a batch of new Ads. The adGroupId field of the Ad indicates which AdGroup to add the Ad to. The adGroupId field is required, and the indicated AdGroup must exist already.
my @ads = $service->addAds($ad1, $ad2);
A list of Google::Adwords::Ad objects to be added.
A list of Google::Adwords::Ad objects just created with their IDs filled in.
Searches for businesses with similar attributes. This call is similar to querying Google Local Search. All parameters are required.
my @businesses = $service->findBusinesses({ name => 'business name', address => 'address of business', countryCode => 'IN', });
A hashref with following keys :
name => Name of the business
address => Location of the business
countryCode => Two letter country code of the business address.
A list of matching businesses, each as a Google::Adwords::Business object
Return all active Ads associated with the list of AdGroup ids specified.
my @ads = $obj->getActiveAds($adgroupid1, $adgroupid2);
List of adgroupids from which we want the active Ads
A list of Google::Adwords::Ad objects
Return information about one Ad.
my $ad = $service->getAd($adgroup_id, $ad_id);
The requested Ad as a Google::Adwords::Ad object.
Get statistics for a list of ads in an ad group.
my @ad_stats = $service->getAdStats({ adGroupId => 1234, adIds => [ 3982, 2787, 17872 ], startDay => $startDay, endDay => $endDay, inPST => 1, });
Takes a hashref with following keys,
* adGroupId => The ad group that contains the Ads to be queried
* adIds => array reference of Ad IDs
* startDay => The starting day of the period for which statistics are to be collected in format YYYY-MM-DD
* endDay => The ending day of the period for which statistics are to be collected in format YYYY-MM-DD
* inPST => Set to 1 to get stats in America/Los_Angeles timezone (Google headquarters) regardless of the parent account's localtimezone.
A list of Google::Adwords::StatsRecord objects
Return all Ads (enabled, disabled, or paused) associated with the list of AdGroup ids specified.
my @ads = $service->getAllAds($adgroup_id1, $adgroup_id2);
A list of AdGroup IDs that own the Ads
Returns the list of businesses registered to the user in the Local Business Center. The user is determined by the clientEmail header if it is specified. Otherwise, the email header is used instead.
my @businesses = $self->getMyBusinesses();
NONE
A list of Google::Adwords::Business objects
Update a batch of ads. Use the id field of the ad to indicate which ad to update. Currently only the status field is updateable, all other fields will be ignored.
$ret = $obj->updateAds($ad1, $ad2);
A List of Google::Adwords::Ad objects to be updated
1 on success
Google::Adwords::Ad
Google::Adwords::Business
Google::Adwords::StatsRecord
Rohan Almeida <rohan@almeida.in>
Mathieu Jondet <mathieu@eulerian.com>
Copyright (c) 2006 Rohan Almeida <rohan@almeida.in>. All rights reserved.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
To install Google::Adwords, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Google::Adwords
CPAN shell
perl -MCPAN -e shell install Google::Adwords
For more information on module installation, please visit the detailed CPAN module installation guide.