Google::Adwords::AdGroupService - Interact with the Google Adwords AdGroupService API calls
This documentation refers to Google::Adwords::AdGroupService version 0.0.2
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;
Create a new AdGroup.
my $adgroup = $obj->addAdGroup($campaignId, $adgroup_obj);
Takes the campaignId in which the adgroup is to be added and a Google::Adwords::AdGroup object.
$adgroup => The new adgroup details as a Google::Adwords::AdGroup object
Create multiple new AdGroups. All the AdGroups must be associated with the same Campaign.
my @adgroups = $obj->addAdGroupList($campaignId, \@adgroups_to_add);
$campaignId => Campaign ID
\@adgroups_to_add => arrayref of Google::Adwords::AdGroup objects
@adgroups => List of AdGroup objects with details filled in.
Get information on an existing adgroup.
my $adgroup = $obj->getAdGroup($id);
Takes the id of the targeted adgroup.
$adgroup => The adgroup details as a Google::Adwords::AdGroup object
Get details on a specific list of adgroups
my @adgroup_ids = (1001, 1002, 1003); my @adgroups = $obj->getAdGroupList(@adgroup_ids);
A list of adgroup ids.
A list of Adgroup objects
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.
my @stats = $obj->getAdGroupStats({ campaignId => $campaignId, adGroupIds => [ $id1, $id2, $id3 ], startDay => '2006-08-01' endDay => '2006-08-31', inPST => 1, });
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
inPST : 1 => get stats in America/Los_Angeles timezone (Google headquarters) regardless of the parent account's localtimezone.
A list of Google::Adwords::StatsRecord objects for each adgroup.
Get all information about the adgroups associated with a campaign.
my @adgroups = $obj->getAllAdGroups($campaignId);
The id of the campaign.
@adgroups => An list of all the adgroups, each as a Google::Adwords::AdGroup object
Update the fields of an existing adgroup
my $adgroup = Google::Adwords::AdGroup->new; $adgroup->id(1001); $adgroup->maxCpc(700000); my $ret = $obj->updateAdGroup($adgroup);
A Google::Adwords::AdGroup object which needs to be updated.
1 on success
Update the fields of multiple existing adgroups
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/);
A list of Google::Adwords::AdGroup objects which needs to be updated.
Google::Adwords::AdGroup
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.