The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

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

VERSION

This documentation refers to Google::Adwords::TrafficEstimatorService version 0.1.2

SYNOPSIS

    use Google::Adwords::TrafficEstimatorService;

    use Google::Adwords::AdGroupRequest;
    use Google::Adwords::KeywordRequest;
    use Google::Adwords::CampaignRequest;

    # Create the service object
    my $service = Google::Adwords::TrafficEstimatorService->new();

    # Login to the Adwords server
    $service->email($email)
            ->password($password)
            ->applicationToken($app_token)
            ->developerToken($dev_token);

    # if you use a MCC
    #$service->clientEmail('clientemail@domain.com');
    # or 
    #$service->clientCustomerId($customerid);

    # create some KeywordRequest objects
    my $kwreq1 = Google::Adwords::KeywordRequest->new
                ->text('web analytics')
                ->type('Broad')
                ->maxCpc(1000000);

    my $kwreq2 = Google::Adwords::KeywordRequest->new
                ->text('anti spam product')
                ->type('Broad')
                ->maxCpc(1000000);

    # estimateKeywordList
    my @keyword_estimates = $service->estimateKeywordList($kwreq1, $kwreq2);
    for ( @keyword_estimates ) {
        print "Id : " . $_->id . " | upperAvgPosition : " 
            . $_->upperAvgPosition . "\n";
    }

    # Create AdGroupRequest objects
    my $adgrpreq1 = Google::Adwords::AdGroupRequest->new
                        ->maxCpc(50000000)
                        ->keywordRequests($kwreq1, $kwreq2);

    # estimateAdGroupList
    my @adgroupestimates = $service->estimateAdGroupList($adgrpreq1);
    for ( @adgroupestimate ) {
        print "Id : " . $_->id . "\n";
        foreach my $kw ( @{$_->keywordEstimates} ) {
            print "\tId: " . $kw->id . " | upperAvgPosition : " 
                . $kw->upperAvgPosition . "\n";
        }
    }

    # Create a CampaignRequest object
    my $cmpgreq1 = Google::Adwords::CampaignRequest->new;

    # geoTargeting
        $cmpgreq1->geoTargeting({ cities => [ 'Pelican, AK US' ] });

    # languageTargeting
    $cmpgreq1->languageTargeting({
        languages => [ 'fr', 'en' ] 
    });

    $cmpgreq1->adGroupRequests($adgrpreq1);

    # estimateCampaignList
    my @campaign_estimates = $service->estimateCampaignList($cmpgreq1);
    for ( @campaign_estimates ) {
        print "Id : " . $_->id . "\n";
        foreach my $adgrp ( @{$_->adGroupEstimates} ) {
            print "\tAdGroup Id: " . $adgrp->id . "\n";
            foreach my $kw ( @{$adgrp->keywordEstimates} ) {
                print "\t\tKeyword Id: " . $kw->id 
                    . " | upperAvgPosition : " . $kw->upperAvgPosition . "\n";
            }
        }
    }
  

DESCRIPTION

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

METHODS

estimateAdGroupList()

Description

    Returns traffic estimates for the requested set of new or existing ad groups. All of the ad groups must be new or all of the ad groups must be from the same campaign. New ad groups are estimated as if they were part of a new campaign with global targeting.

Usage

        my @adgroup_estimates = $obj->estimateAdGroupList($adgrpreq1, $adgrpreq2);

Parameters

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

Returns

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

estimateCampaignList()

Description

    Returns traffic estimates for the requested set of campaigns. The campaigns can be all new or all existing, or a mixture of new and existing.

Usage

        my @campaign_estimates = $obj->estimateCampaignList($cmpgnreq1, $cmpgnreq2);

Parameters

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

Returns

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

estimateKeywordList()

Description

    Returns traffic estimates for the requested set of new keywords. All of the keywords must be new. Keywords are estimated as if they were part of a single new ad group in a single new campaign with global targeting.

Usage

        my @keyword_estimates = $obj->estimateKeywordList($kwreq1, $kwreq2);

Parameters

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

Returns

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

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.