Google::Adwords::CriterionService - Interact with the Google Adwords CriterionService API calls
This documentation refers to Google::Adwords::CriterionService version 0.4
use Google::Adwords::CriterionService; use Google::Adwords::Criterion; # create the CriterionService object my $criterion_service = Google::Adwords::CriterionService->new(); # need to login to the Adwords service $criterion_service->email($email_address) ->password($password) ->developerToken($developer_token) ->applicationToken($app_token); # if you have a MCC $criterion_service->clientEmail($client_email); # or $criterion_service->clientCustomerId($customerid); my $adgroupid = 123456789; # get all the criteria for an adgroup my @getallcriteria = $criterion_service->getAllCriteria($adgroupid); for ( @getallcriteria ) { print "Criterion Id : " . $_->id . "\n"; } # get a specific criterion from an AdGroup my $criterionid = 987654321; my $getcriterion = $criterion_service->getCriteria($adgroupid, [ $criterionid ]); print "Got Criterion Id : " . $getcriterion->id . "\n"; # remove a criterion my $ret = $criterion_service->removeCriteria($adgroupid, [ $criterionid ]); # add a criterion my $criterion_keyword = Google::Adwords::Criterion->new ->adGroupId($adgroupid) ->criterionType('Keyword') ->type('Broad') ->text('Aarohan & Technologies'); my $addcriterion = $criterion_service->addCriteria($criterion_keyword); print "Added Criterion ID: " . $addcriterion->id . "\n";
This module provides an interface to the Google Adwords CriterionService API calls.
Add a new Criteria to this AdGroup.
my @added_criteria = $service->addCriteria($criterion1, $criterion2);
A list of Google::Adwords::Criterion objects to be added
A list of the newly added criterions, each as a Google::Adwords::Criterion object
Not Implemented.
Return a list of criteria associated with this AdGroup.
my @criteria = $obj->getAllCriteria($adgroup_id);
1) $adgroup_id => the id of the AdGroup.
A list of Google::Adwords::Criterion objects.
Gets a list of the negative criteria associated with a campaign. Negative criteria determine where the ads in the campaign will not be displayed. Negative website criteria indicate websites where the ads will not appear. Negative keyword criteria indicate keywords that cause the ads to be excluded from display.
my @criteria = $obj->getCampaignNegativeCriteria($campaign_id);
@criteria => A list of Google::Adwords::Criterion objects
Return a list of criteria with the specified IDs associated with this AdGroup. This function will only return criteria associated with one AdGroup at a time. Invalid IDs are ignored.
my @criteria = $obj->getCriteria($adgroup_id, [ $criterion_id1 ]);
Get statistics for a list of Criteria. 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 @criterion_stats = $service->getCriterionStats({ adGroupId => 1234, criterionIds => [ 3982, 2787, 17872 ], startDay => $startDay, endDay => $endDay, });
Takes a hashref with following keys,
* adGroupId => The ad group that contains the criterion to be queried
* criterionIds => array reference of criterion 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
A list of Google::Adwords::StatsRecord objects; one for each criterion.
Remove a list of Criteria from an AdGroup.
my $ret = $obj->removeCriteria($adGroupId, [ $criterionId ]);
1 on success
Removes all existing negative criteria from a campain and sets new negative criteria for the specified campaign. Negative criteria determine where the ads in the campaign will not be displayed. Negative website criteria indicate websites where the ads will not appear. Negative keyword criteria indicate keywords that cause the ads to be excluded from display.
Calling this method with a null or empty list clears the negative criteria for the campaign. If your campaign already has some negative criteria and you want to add more, first call getCampaignNegativeCriteria, then add the new negative criteria to the results and send the complete set of negative criteria to setCampaignNegativeCriteria.
my $ret = $obj->setCampaignNegativeCriteria($campaign_id, [ $criterion1 ]);
Update all mutable fields associated with these Criteria. Only the maxCpc, maxCpm, negative, paused, and destinationUrl fields are mutable.
my $ret = $service->updateCriteria($criterion1, $criterion2);
A List of Google::Adwords::Criterion objects to be updated
Google::Adwords::Criterion
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.