Rohan Almeida > Google-Adwords > Google::Adwords::CampaignService

Download:
Google-Adwords-v1.14.tar.gz

Dependencies

Annotate this POD

CPAN RT

New  5
Open  2
View Bugs
Report a bug
Module Version: 0.11.0   Source  

NAME ^

Google::Adwords::CampaignService - Interface to the Google Adwords CampaignService API calls

VERSION ^

This documentation refers to Google::Adwords::CampaignService version 0.10

SYNOPSIS ^

    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;

DESCRIPTION ^

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.

METHODS ^

addCampaign()

Description

Create a new campaign.

Usage

    my $campaign_response = $obj->addCampaign($campaign);

Parameters

1) $campaign - A Google::Adwords::Campaign object

Returns

$campaign_response => The new campaign details as a Google::Adwords::Campaign object

addCampaignList()

Description

Add a list of new Campaigns

Usage

    my @campaign_responses = $obj->addCampaignList(@campaigns_to_add);

    # or even
    my @campaign_responses 
        = $obj->addCampaignList($campaign1, $campaign2);

Parameters

1) @campaigns_to_add - A List of Google::Adwords::Campaign objects which should be added

Returns

@campaign_responses => A List of Google::Adwords::Campaign objects which were added

getAllAdWordsCampaigns()

Description

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.

Usage

        my @campaigns = $obj->getAllAdWordsCampaigns();

Parameters

None.

Returns

@campaigns => A list of Google::Adwords::Campaign objects

getCampaign()

Description

Return all information about a specified Campaign.

Usage

    my $campaign = $obj->getCampaign($id);

Parameters

1) $id - The id of the campaign you want details for.

Returns

$campaign => The campaign details as a Google::Adwords::Campaign object

getCampaignList()

Description

Return information about a list of Campaigns.

Usage

    my @campaigns = $obj->getCampaignList(@campaign_ids);

Parameters

A list of campaign ids you require information about

Returns

@campaigns => A list of Google::Adwords::Campaign objects

getCampaignStats()

Description

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

Usage

    my @campaign_stats = $obj->getCampaignStats({
        campaignids     => [ 3567, 4567, 8819 ],
        startDay => '2006-08-01',
        endDay  => '2006-08-31',
    });

Parameters

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

Returns

An list of Google::Adwords::StatsRecord objects for each campaign

getOptimizeAdServing()

Description

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

Usage

    my $is_optimized = $obj->getOptimizeAdServing($id);

Parameters

1) $id - The campaign id.

Returns

1 if the flag is set to 'true', 0 if set to 'false'.

setOptimizeAdServing()

Description

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.

Usage

    my $ret = $obj->setOptimizeAdServing($id, 1); # to set the flag
    my $ret = $obj->setOptimizeAdServing($id, 0); # to unset the flag

Parameters

The campaign id and a boolean (1 or 0) for setting/unsetting the flag.

Returns

Returns 1 on success

updateCampaign()

Description

Update the settings for an existing campaign.

Usage

    my $ret = $obj->updateCampaign($campaign);

Parameters

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

Returns

Returns 1 on success

updateCampaignList()

Description

Update the settings for a list of existing campaigns.

Usage

    my $ret = $obj->updateCampaignList(@campaigns);

Parameters

@campaigns => A list of Google::Adwords::Campaign objects which need updating

Returns

Returns 1 on success

SEE ALSO ^

AUTHORS ^

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.