Google::Adwords::CriterionService - Interact with the Google Adwords


Google-Adwords documentation  | view source Contained in the Google-Adwords distribution.

Index


NAME

Top

Google::Adwords::CriterionService - Interact with the Google Adwords CriterionService API calls

VERSION

Top

This documentation refers to Google::Adwords::CriterionService version 0.4

SYNOPSIS

Top

    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";

  


DESCRIPTION

Top

This module provides an interface to the Google Adwords CriterionService API calls.

METHODS

Top

addCriteria()

Description

    Add a new Criteria to this AdGroup.

Usage

    my @added_criteria = $service->addCriteria($criterion1, $criterion2);

Parameters

A list of Google::Adwords::Criterion objects to be added

Returns

A list of the newly added criterions, each as a Google::Adwords::Criterion object

checkCriteria()

Not Implemented.

getAllCriteria()

Description

Return a list of criteria associated with this AdGroup.

Usage

    my @criteria = $obj->getAllCriteria($adgroup_id);

Parameters

1) $adgroup_id => the id of the AdGroup.

Returns

A list of Google::Adwords::Criterion objects.

getCampaignNegativeCriteria()

Description

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.

Usage

    my @criteria = $obj->getCampaignNegativeCriteria($campaign_id);

Parameters

1) $campaign_id => The campaign ID

Returns

@criteria => A list of Google::Adwords::Criterion objects

getCriteria()

Description

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.

Usage

    my @criteria = $obj->getCriteria($adgroup_id, [ $criterion_id1 ]);

Parameters

1) $adgroup_id : the id of the AdGroup
2) arrayref of Criterion Ids

Returns

@criteria => A list of Google::Adwords::Criterion objects

getCriterionStats()

Description

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

Usage

   my @criterion_stats = $service->getCriterionStats({
        adGroupId   => 1234,
        criterionIds => [ 3982, 2787, 17872 ],
        startDay    => $startDay,
        endDay      => $endDay,
    });

Parameters

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

Returns

A list of Google::Adwords::StatsRecord objects; one for each criterion.

removeCriteria()

Description

Remove a list of Criteria from an AdGroup.

Usage

    my $ret = $obj->removeCriteria($adGroupId, [ $criterionId ]);

Parameters

1) $adGroupId : the id of the adgroup
2) array ref of criterion Ids

Returns

1 on success

setCampaignNegativeCriteria()

Description

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.

Usage

    my $ret = $obj->setCampaignNegativeCriteria($campaign_id, [ $criterion1 ]);

Parameters

1) $campaign_id => The campaign ID
2) arrayref of Criterion objects

Returns

1 on success

updateCriteria()

Description

Update all mutable fields associated with these Criteria. Only the maxCpc, maxCpm, negative, paused, and destinationUrl fields are mutable.

Usage

    my $ret = $service->updateCriteria($criterion1, $criterion2);

Parameters

A List of Google::Adwords::Criterion objects to be updated

Returns

1 on success

SEE ALSO

Top

* Google::Adwords::Criterion
* Google::Adwords::StatsRecord

AUTHORS

Top

Rohan Almeida <rohan@almeida.in>

Mathieu Jondet <mathieu@eulerian.com>

LICENSE AND COPYRIGHT

Top


Google-Adwords documentation  | view source Contained in the Google-Adwords distribution.