Google::Adwords::Campaign - A Google Adwords Campaign Object


Google-Adwords documentation Contained in the Google-Adwords distribution.

Index


Code Index:

NAME

Top

Google::Adwords::Campaign - A Google Adwords Campaign Object

VERSION

Top

This documentation refers to Google::Adwords::Campaign version 0.3

SYNOPSIS

Top

    use Google::Adwords::Campaign;
    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->dailyBudget(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 use 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

Top

This object should be used with the CampaignService API calls

METHODS

Top

Mutators (read/write)

* budgetOptimizerSettings

* dailyBudget

* enableSeparateContentBids

* name

* status

* schedule

* startDay

* endDay

* languageTargeting

* geoTargeting

* networkTargeting

Accessors (read only)

* id

The following methods accept/return a hashref

languageTargeting()

A hashref with keys:

* languages - An arrayref of language codes

Example usage:

    # set English and Hindi as my language targets
    $campaign->languageTargeting({
        languages => [ 'en', 'hi' ],
    });

The language codes are available here:

http://www.google.com/apis/adwords/developer/adwords_api_languages.html

geoTargeting()

Accept/return a Google::Adwords::GeoTarget object

Example usage:

    # Set target countries as US and India
    my $geo_target = Google::Adwords::GeoTarget->new();
    my $targets = Google::Adwords::CountryTargets->new();
    $targets->countries([ 'US', 'IN' ]);
    $geo_target->countryTargets($targets);
    $campaign->geoTargeting($geo_target);

    # Only target Adelaide in Australia
    my $targets = Google::Adwords::CityTargets->new();
    $targets->cities([ 'Adelaide, SA AU' ]);
    $geo_target->cityTargets($targets);
    $campaign->geoTargeting($geo_target);

    # By region, target Berlin in Germany
    my $targets = Google::Adwords::RegionTargets->new();
    $targets->regions([ 'DE-BE' ]);
    $geo_target->regionTargets($targets);
    $campaign->geoTargeting($geo_target);

    # By metros, target Los Angeles
    my $targets = Google::Adwords::MetroTargets->new();
    $targets->metros([ '803' ]);
    $geo_target->metroTargets($targets);
    $campaign->geoTargeting($geo_target);




The codes are available here:

countries -

http://www.google.com/apis/adwords/developer/adwords_api_countries.html

regions -

http://www.google.com/apis/adwords/developer/adwords_api_regions.html

cities (outside the US) -

http://www.google.com/apis/adwords/developer/adwords_api_cities.html

cities (in the US) -

http://www.google.com/apis/adwords/developer/adwords_api_us_cities.html

metros (in the US) -

http://www.google.com/apis/adwords/developer/adwords_api_us_metros.html

From the Adwords website:

You can target campaigns by cities, countries, metros, and regions. However, a single campaign can only target one geographic area. For example, you can target a campaign by countries or regions, but not both. You can specify multiple values within a single type of geographic area. For example, you could target a campaign by more than one country.

More info is here:

http://www.google.com/apis/adwords/developer/adwords_api_geotarget.html

networkTargeting()

A hashref with keys:

* networkTypes => arrayref of network names

Exmaple usage:

    # target only the google search network
    $campaign->networkTargeting({
        networkTypes => [ 'GoogleSearch' ],
    });




The network types are:

* GoogleSearch

* SearchNetwork

* ContentNetwork

From the Adwords website:

When creating a new campaign, if no targeting is specified, the default targeting is GoogleSearch. SearchNetwork encompasses GoogleSearch, so GoogleSearch need not be specified when this value is included.

More info is here:

http://www.google.com/apis/adwords/developer/NetworkTarget.html

SEE ALSO

Top

* Google::Adwords::CampaignService
* Google::Adwords::GeoTarget
* Google::Adwords::CityTargets
* Google::Adwords::CountryTargets
* Google::Adwords::MetroTargets
* Google::Adwords::RegionTargets
* Google::Adwords::AdSchedule
* Google::Adwords::SchedulingInterval
* Google::Adwords::BudgetOptimizerSettings

AUTHOR

Top

Rohan Almeida <rohan@almeida.in>

LICENSE AND COPYRIGHT

Top


Google-Adwords documentation Contained in the Google-Adwords distribution.

package Google::Adwords::Campaign;
use strict;
use warnings;

use version; our $VERSION = qv('0.4');

use base 'Google::Adwords::Data';

my @fields = qw/
    budgetAmount
    budgetOptimizerSettings
    budgetPeriod
    contentTargeting
    conversionOptimizerSettings
    enableSeparateContentBids
    endDay
    geoTargeting
    id
    languageTargeting
    name
    networkTargeting
    schedule
    startDay
    status
    /;

__PACKAGE__->mk_accessors(@fields);

1;