Google::Adwords::CampaignService - Interface to the Google Adwords CampaignService API calls
This documentation refers to Google::Adwords::CampaignService version 0.10
use Google::Adwords::Campaign; use Google::Adwords::GeoTarget; use Google::Adwords::CityTargets; use Google::Adwords::CampaignService; # create a new campaign object my $campaign = Google::Adwords::Campaign; # set values for the campaign object $campaign->name('My Final Try'); $campaign->budgetAmount(10000000); # target a certain city in US my $geo_target = Google::Adwords::GeoTarget->new(); my $city_targets = Google::Adwords::CityTargets->new(); $city_targets->cities([ 'Pelican, AK US' ]); $geo_target->cityTargets($city_targets); $campaign->geoTargeting($geo_target); # create the campaign service object my $campaign_service = Google::Adwords::CampaignService->new(); # need to login to the Adwords service $campaign_service->email($email_address) ->password($password) ->developerToken($developer_token) ->applicationToken($application_token); # if you have a MCC $campaign_service->clientEmail($client_email); # or $campaign_service->clientCustomerId($customerid); # now create the campaign my $campaign_response = $campaign_service->addCampaign($campaign); print "New campaign ID is :" . $campaign_response->id;
This module provides an interface to the Google Adwords CampaignService API calls. Please read Google::Adwords::Campaign on how to setup and receive information about your campaigns.
Create a new campaign.
my $campaign_response = $obj->addCampaign($campaign);
1) $campaign - A Google::Adwords::Campaign object
$campaign_response => The new campaign details as a Google::Adwords::Campaign object
Add a list of new Campaigns
my @campaign_responses = $obj->addCampaignList(@campaigns_to_add); # or even my @campaign_responses = $obj->addCampaignList($campaign1, $campaign2);
1) @campaigns_to_add - A List of Google::Adwords::Campaign objects which should be added
@campaign_responses => A List of Google::Adwords::Campaign objects which were added
Return all information about all Campaigns belonging to the customer issuing the request. Ad Automator campaigns will not be included in the list of returned campaigns.
my @campaigns = $obj->getAllAdWordsCampaigns();
None.
@campaigns => A list of Google::Adwords::Campaign objects
Return all information about a specified Campaign.
my $campaign = $obj->getCampaign($id);
1) $id - The id of the campaign you want details for.
$campaign => The campaign details as a Google::Adwords::Campaign object
Return information about a list of Campaigns.
my @campaigns = $obj->getCampaignList(@campaign_ids);
A list of campaign ids you require information about
Get statistics for a list of Campaigns. See Google::Adwords::StatsRecord for details about the statistics returned. The time granularity is one day.
Also see -
http://www.google.com/apis/adwords/developer/StatsRecord.html
my @campaign_stats = $obj->getCampaignStats({ campaignids => [ 3567, 4567, 8819 ], startDay => '2006-08-01', endDay => '2006-08-31', });
Takes a hashref with following keys,
* campaignids => An array ref of campaign ids you want stats for
* 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
An list of Google::Adwords::StatsRecord objects for each campaign
Retrieve the 'optimized ad serving' setting for this campaign. If optimized ad serving is enabled for a campaign, creatives with the best clickthrough rates will be favored. This setting applies to all AdGroups in the Campaign.
More info is here -
https://adwords.google.com/select/tips.html#AdServing
my $is_optimized = $obj->getOptimizeAdServing($id);
1) $id - The campaign id.
1 if the flag is set to 'true', 0 if set to 'false'.
Modify the 'optimized ad serving' setting for this campaign. New campaigns have optimized ad serving enabled by default. This setting can only be toggled for Campaigns that have at least one Creative associated with them.
my $ret = $obj->setOptimizeAdServing($id, 1); # to set the flag my $ret = $obj->setOptimizeAdServing($id, 0); # to unset the flag
The campaign id and a boolean (1 or 0) for setting/unsetting the flag.
Returns 1 on success
Update the settings for an existing campaign.
my $ret = $obj->updateCampaign($campaign);
1) $campaign - A Google::Adwords::Campaign object which needs updating. Make sure you have at the least set the id of the object. If you need to update only certain fileds, then use the accessor to set the value. Fields which don't have values will not be updated
Update the settings for a list of existing campaigns.
my $ret = $obj->updateCampaignList(@campaigns);
@campaigns => A list of Google::Adwords::Campaign objects which need updating
Google::Adwords::Campaign
Google::Adwords::GeoTarget
Google::Adwords::CityTargets
Google::Adwords::CountryTargets
Google::Adwords::MetroTargets
Google::Adwords::RegionTargets
Google::Adwords::StatsRecord
Google::Adwords::AdSchedule
Google::Adwords::SchedulingInterval
Google::Adwords::BudgetOptimizerSettings
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.