NAME
Google::Adwords::AdGroupService - Interact with the Google Adwords AdGroupService API calls
VERSION
This documentation refers to Google::Adwords::AdGroupService version 0.2
SYNOPSIS
use Google::Adwords::AdGroup;
use Google::Adwords::AdGroupService;
# create a new adgroup object
my $adgroup = Google::Adwords::AdGroup->new;
# set values for the adgroup object
$adgroup->name('My Final Try');
$adgroup->maxCpc(500000);
# create the adgroup service object
my $adgroup_service = Google::Adwords::AdGroupService->new();
# need to login to the Adwords service
$adgroup_service->email($email_address)
->password($password)
->developerToken($developer_token)
->applicationToken($application_token);
# if you use a MCC
#$adgroup_service->clientEmail($client_email);
# or
#$adgroup_service->clientCustomerId($customerid);
# now create the adgroup
my $campaignId = 1234; # within this campaign
my $adgroup_response = $adgroup_service->addAdGroup($campaignId, $adgroup);
print "New adgroup ID is :" . $adgroup_response->id;
METHODS
addAdGroup()
Description
Create a new AdGroup.
Usage
my $adgroup = $obj->addAdGroup($campaignId, $adgroup_obj);
Parameters
Takes the campaignId in which the adgroup is to be added and a Google::Adwords::AdGroup object.
Returns
$adgroup => The new adgroup details as a Google::Adwords::AdGroup object
addAdGroupList()
Description
Create multiple new AdGroups. All the AdGroups must be associated with the same Campaign.
Usage
my @adgroups = $obj->addAdGroupList($campaignId, \@adgroups_to_add);
Parameters
$campaignId => Campaign ID
\@adgroups_to_add => arrayref of Google::Adwords::AdGroup objects
Returns
@adgroups => List of AdGroup objects with details filled in.
getAdGroup()
Description
Get information on an existing adgroup.
Usage
my $adgroup = $obj->getAdGroup($id);
Parameters
Takes the id of the targeted adgroup.
Returns
$adgroup => The adgroup details as a Google::Adwords::AdGroup object
getAdGroupList()
Description
Get details on a specific list of adgroups
Usage
my @adgroup_ids = (1001, 1002, 1003);
my @adgroups = $obj->getAdGroupList(@adgroup_ids);
Parameters
A list of adgroup ids.
Returns
A list of Adgroup objects
getAdGroupStats()
Description
Get statistics for a list of ad groups in a campaign. Returns the statictics as a Google::Adwords::StatsRecord object for each adgroup. The time granularity is one day.
Usage
my @stats = $obj->getAdGroupStats({
campaignId => $campaignId,
adGroupIds => [ $id1, $id2, $id3 ],
startDay => '2006-08-01'
endDay => '2006-08-31',
});
Parameters
Takes a hashref with keys -
campaignId - The campaign in which to find the ad groups
adGroupIds - arrayref of adgroup ids
startDay - The starting day of the period for which statistics are to be collected. Format is YYYY-MM-DD
endDay - The ending day of the period for which statistics are to be collected, inclusive. Format is YYYY-MM-DD
Returns
A list of Google::Adwords::StatsRecord objects for each adgroup.
getAllAdGroups()
Description
Get all information about the adgroups associated with a campaign.
Usage
my @adgroups = $obj->getAllAdGroups($campaignId);
Parameters
The id of the campaign.
Returns
@adgroups => An list of all the adgroups, each as a Google::Adwords::AdGroup object
updateAdGroup()
Description
Update the fields of an existing adgroup
Usage
my $adgroup = Google::Adwords::AdGroup->new;
$adgroup->id(1001);
$adgroup->maxCpc(700000);
my $ret = $obj->updateAdGroup($adgroup);
Parameters
A Google::Adwords::AdGroup object which needs to be updated.
Returns
1 on success
updateAdGroupList()
Description
Update the fields of multiple existing adgroups
Usage
my $adgroup1 = Google::Adwords::AdGroup->new;
$adgroup1->id(1001);
$adgroup1->maxCpc(700000);
my $adgroup2 = Google::Adwords::AdGroup->new;
$adgroup2->id(1002);
$adgroup2->maxCpm(700000);
my $ret = $obj->updateAdGroupList(qw/$adgroup1 $adgroup2/);
Parameters
A list of Google::Adwords::AdGroup objects which needs to be updated.
Returns
1 on success
SEE ALSO
AUTHOR
Rohan Almeida <rohan@almeida.in>
Mathieu Jondet <mathieu@eulerian.com>
LICENSE AND COPYRIGHT
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.