view release on metacpan or search on metacpan
operations at the same time. This utility is used in conjunction with
BatchJobService. For example, campaigns, ad groups, and criterion can all
be added in one batch job.
- Added a new property to adwords.properties (oAuth2AdditionalScopes) providing
the ability to configure additional OAuth 2.0 scopes.
- Fixed issue on GitHub. See
https://github.com/googleads/googleads-perl-lib/issues/12
4.0.1
- Updated documentation in the comments.
- Updated generating offline credentials to take input from adwords.properties.
4.0.0
- This library now supports a minimum of Perl version 5.14. The version of
Perl needed to be updated to stay current with newer versions of the
SOAP library and newer versions of Perl.
- Removed support for v201409.
3.5.0
- Added examples and support for v201506.
- Added a new paging utility for iterating over pages called PageProcessor.pm.
adwords.properties
Build.PL
Changes
CONTRIBUTING.md
COPYING
examples/oauth/authenticate_with_web_flow.pl
examples/oauth/generate_offline_credentials.pl
examples/v201809/account_management/accept_service_link.pl
examples/v201809/account_management/create_account.pl
examples/v201809/account_management/get_account_changes.pl
examples/v201809/account_management/get_account_hierarchy.pl
examples/v201809/advanced_operations/add_ad_customizer.pl
examples/v201809/advanced_operations/add_ad_group_bid_modifier.pl
examples/v201809/advanced_operations/add_dynamic_page_feed.pl
examples/v201809/advanced_operations/add_dynamic_search_ads_campaign.pl
examples/v201809/advanced_operations/add_expanded_text_ad_with_upgraded_urls.pl
examples/v201809/advanced_operations/add_gmail_ad.pl
[AdWords API](https://developers.google.com/adwords/api/) Perl Client Library makes it easier to write Perl clients to
programmatically access [AdWords](https://adwords.google.com/select/Login) accounts.
## Features
- Fully featured object oriented client library (all classes come generated from
- the WSDLs)
- Perl 5.14.0+ and based on SOAP::WSDL module
- Outgoing and incoming SOAP message are monitored and logged on demand
- Support for API calls to production system or sandbox
- OAuth2 Support
- Loading of credentials from local file or source code
- Online
[documentation](https://metacpan.org/release/Google-Ads-AdWords-Client)
## Getting started
***NOTE:*** If you are using Windows, go through the instructions under ***What if I'm using Windows?*** first before continuing here.
- Download the newest version from [releases](https://github.com/googleads/googleads-perl-lib/releases) or from [CPAN Google::Ads::AdWords::Client](http://search.cpan.org/~sundquist/).
- Install dependencies.
```
$ perl Build.PL
$ perl Build installdeps
```
- Copy the sample **adwords.properties** for your product to your home directory
and fill out the required properties.
* [AdWords adwords.properties](https://github.com/googleads/googleads-perl-lib/blob/master/adwords.properties)
- Setup your OAuth2 credentials.
The AdWords API uses
[OAuth2](http://oauth.net/2/) as the authentication mechanism. Follow the appropriate guide below based on your use case.
**If you're accessing an API using your own credentials...**
* [Using AdWords](https://github.com/googleads/googleads-perl-lib/wiki/API-access-using-own-credentials-(installed-application-flow))
**If you're accessing an API on behalf of clients...**
* [Developing a web application](https://github.com/googleads/googleads-perl-lib/wiki/API-Access-on-behalf-of-your-clients-(web-flow))
## How do I use the library?
There are code examples for most of the common use cases in the [repository](https://github.com/googleads/googleads-perl-lib/tree/master/examples). These code examples are also available as part of the [release distributions](https://github.com/googl...
### How do I run the examples?
adwords.properties view on Meta::CPAN
#
# Then you need one of the following two options.
#
# Option 1: Uncomment the following if you already have OAuth2 authorization
# tokens.
# oAuth2AccessToken=INSERT_OAUTH_TOKEN_HERE
# oAuth2RefreshToken=INSERT_OAUTH_TOKEN_HERE
#
# Option 2: Use the library to trigger the authorization flow and have the
# user authorize access to his account. See the
# examples/oauth/generate_offline_credentials.pl to learn how to use the
# library for requesting user authorization.
#
# Optionally, uncomment the following if you want to change defaults for the
# user interaction flow.
# Default offline
# oAuth2AccessType=[online|offline]
# Default auto
# oAuth2ApprovalPrompt=[force|auto]
# Defaults to urn:ietf:wg:oauth:2.0:oob
# oAuth2RedirectUri=INSERT_REDIRECT_URI_HERE
examples/oauth/authenticate_with_web_flow.pl view on Meta::CPAN
} else {
print "HTTP/1.0 404 Not found\r\n";
print $cgi->header,
$cgi->start_html('Not found'),
$cgi->h1('Not found'),
$cgi->end_html;
}
}
# This starts the OAuth2 authentication process where the user will be
# prompted to log in with the credentials that have access to their AdWords
# account. During this process, the user has to confirm that permission is
# granted for our application to access AdWords using their credentials.
sub resp_login {
my $cgi = shift;
return if !ref $cgi;
# Get AdWords Client, ~/adwords.properties will be read.
$client = Google::Ads::AdWords::Client->new();
$auth_handler = $client->get_oauth_2_handler();
# Create an HTTP POST request to call the AdWords login.
my $ua = LWP::UserAgent->new;
examples/oauth/generate_offline_credentials.pl view on Meta::CPAN
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This utility script demonstrate how to generate offline credentials for
# OAuth2 Installed Applications. The generated refresh token can then be used
# to configure the client library, refer to the OAuth2 section of the
# adwords.properties file. This example is meant to be run from the command line
# and requires user input.
use strict;
use lib "../../lib";
use Google::Ads::AdWords::Client;
use Cwd qw(abs_path);
# Main subroutine.
sub generate_offline_credentials {
my ($client) = @_;
my $auth_handler = $client->get_oauth_2_handler();
my $client_id = $auth_handler->get_client_id();
my $client_secret = $auth_handler->get_client_secret();
if (!$client_id || !$client_secret) {
die("ERROR: Missing input values for oAuth2ClientId or " .
"oAuth2ClientSecret in your adwords.properties file. " .
"These values can be generated from " .
examples/oauth/generate_offline_credentials.pl view on Meta::CPAN
my $str = shift;
$str =~ s/^\s*(.*?)\s*$/$1/;
return $str;
}
# Don't run the example if the file is being included.
if (abs_path($0) ne abs_path(__FILE__)) {
return 1;
}
# Get AdWords Client, credentials will be read from ~/adwords.properties.
my $client = Google::Ads::AdWords::Client->new();
# Call the example
generate_offline_credentials($client);
examples/v201809/account_management/accept_service_link.pl view on Meta::CPAN
}
# Don't run the example if the file is being included.
if (abs_path($0) ne abs_path(__FILE__)) {
return 1;
}
# Log SOAP XML request, response and API errors.
Google::Ads::AdWords::Logging::enable_all_logging();
# Get AdWords Client, credentials will be read from ~/adwords.properties.
my $client = Google::Ads::AdWords::Client->new({version => "v201809"});
# By default examples are set to die on any server returned fault.
$client->set_die_on_faults(1);
# Call the example
accept_service_link($client, $service_link_id);
examples/v201809/account_management/create_account.pl view on Meta::CPAN
}
# Don't run the example if the file is being included.
if (abs_path($0) ne abs_path(__FILE__)) {
return 1;
}
# Log SOAP XML request, response and API errors.
Google::Ads::AdWords::Logging::enable_all_logging();
# Get AdWords Client, credentials will be read from ~/adwords.properties.
my $client = Google::Ads::AdWords::Client->new({version => "v201809"});
# By default examples are set to die on any server returned fault.
$client->set_die_on_faults(1);
# Call the example
create_account($client);
examples/v201809/account_management/get_account_changes.pl view on Meta::CPAN
}
# Don't run the example if the file is being included.
if (abs_path($0) ne abs_path(__FILE__)) {
return 1;
}
# Log SOAP XML request, response and API errors.
Google::Ads::AdWords::Logging::enable_all_logging();
# Get AdWords Client, credentials will be read from ~/adwords.properties.
my $client = Google::Ads::AdWords::Client->new({version => "v201809"});
# By default examples are set to die on any server returned fault.
$client->set_die_on_faults(1);
# Call the example
get_account_changes($client);
examples/v201809/account_management/get_account_hierarchy.pl view on Meta::CPAN
}
# Don't run the example if the file is being included.
if (abs_path($0) ne abs_path(__FILE__)) {
return 1;
}
# Log SOAP XML request, response and API errors.
Google::Ads::AdWords::Logging::enable_all_logging();
# Get AdWords Client, credentials will be read from ~/adwords.properties.
my $client = Google::Ads::AdWords::Client->new({version => "v201809"});
# By default examples are set to die on any server returned fault.
$client->set_die_on_faults(1);
# Call the example
get_account_hierarchy($client);
examples/v201809/advanced_operations/add_ad_customizer.pl view on Meta::CPAN
}
# Don't run the example if the file is being included.
if (abs_path($0) ne abs_path(__FILE__)) {
return 1;
}
# Log SOAP XML request, response and API errors.
Google::Ads::AdWords::Logging::enable_all_logging();
# Get AdWords Client, credentials will be read from ~/adwords.properties.
my $client = Google::Ads::AdWords::Client->new({version => "v201809"});
# By default examples are set to die on any server returned fault.
$client->set_die_on_faults(1);
# Call the example
add_ad_customizers($client, $ad_group_ids, $feed_name);
examples/v201809/advanced_operations/add_ad_group_bid_modifier.pl view on Meta::CPAN
}
# Don't run the example if the file is being included.
if (abs_path($0) ne abs_path(__FILE__)) {
return 1;
}
# Log SOAP XML request, response and API errors.
Google::Ads::AdWords::Logging::enable_all_logging();
# Get AdWords Client, credentials will be read from ~/adwords.properties.
my $client = Google::Ads::AdWords::Client->new({version => "v201809"});
# By default examples are set to die on any server returned fault.
$client->set_die_on_faults(1);
# Call the example
add_ad_group_bid_modifier($client, $ad_group_id);
examples/v201809/advanced_operations/add_dynamic_page_feed.pl view on Meta::CPAN
}
# Don't run the example if the file is being included.
if (abs_path($0) ne abs_path(__FILE__)) {
return 1;
}
# Log SOAP XML request, response and API errors.
Google::Ads::AdWords::Logging::enable_all_logging();
# Get AdWords Client, credentials will be read from ~/adwords.properties.
my $client = Google::Ads::AdWords::Client->new({version => "v201809"});
# By default examples are set to die on any server returned fault.
$client->set_die_on_faults(1);
# Call the example
add_dynamic_page_feed($client, $campaign_id, $ad_group_id);
examples/v201809/advanced_operations/add_dynamic_search_ads_campaign.pl view on Meta::CPAN
}
# Don't run the example if the file is being included.
if (abs_path($0) ne abs_path(__FILE__)) {
return 1;
}
# Log SOAP XML request, response and API errors.
Google::Ads::AdWords::Logging::enable_all_logging();
# Get AdWords Client, credentials will be read from ~/adwords.properties.
my $client = Google::Ads::AdWords::Client->new({version => "v201809"});
# By default examples are set to die on any server returned fault.
$client->set_die_on_faults(1);
# Call the example
add_dynamic_search_ads_campaign($client);
examples/v201809/advanced_operations/add_expanded_text_ad_with_upgraded_urls.pl view on Meta::CPAN
}
# Don't run the example if the file is being included.
if (abs_path($0) ne abs_path(__FILE__)) {
return 1;
}
# Log SOAP XML request, response and API errors.
Google::Ads::AdWords::Logging::enable_all_logging();
# Get AdWords Client, credentials will be read from ~/adwords.properties.
my $client = Google::Ads::AdWords::Client->new({version => "v201809"});
# By default examples are set to die on any server returned fault.
$client->set_die_on_faults(1);
# Call the example
add_text_ad_with_upgraded_urls($client, $ad_group_id);
examples/v201809/advanced_operations/add_gmail_ad.pl view on Meta::CPAN
}
# Don't run the example if the file is being included.
if (abs_path($0) ne abs_path(__FILE__)) {
return 1;
}
# Log SOAP XML request, response and API errors.
Google::Ads::AdWords::Logging::enable_all_logging(1);
# Get AdWords Client, credentials will be read from ~/adwords.properties.
my $client = Google::Ads::AdWords::Client->new({version => "v201809"});
# By default examples are set to die on any server returned fault.
$client->set_die_on_faults(1);
# Call the example
add_gmail_ad($client, $ad_group_id);
examples/v201809/advanced_operations/add_html5_ad.pl view on Meta::CPAN
}
# Don't run the example if the file is being included.
if (abs_path($0) ne abs_path(__FILE__)) {
return 1;
}
# Log SOAP XML request, response and API errors.
Google::Ads::AdWords::Logging::enable_all_logging();
# Get AdWords Client, credentials will be read from ~/adwords.properties.
my $client = Google::Ads::AdWords::Client->new({version => "v201809"});
# By default examples are set to die on any server returned fault.
$client->set_die_on_faults(1);
# Call the example
add_html5_ad($client, $ad_group_id);
examples/v201809/advanced_operations/add_responsive_display_ad.pl view on Meta::CPAN
}
# Don't run the example if the file is being included.
if (abs_path($0) ne abs_path(__FILE__)) {
return 1;
}
# Log SOAP XML request, response and API errors.
Google::Ads::AdWords::Logging::enable_all_logging();
# Get AdWords Client, credentials will be read from ~/adwords.properties.
my $client = Google::Ads::AdWords::Client->new({version => "v201809"});
# By default examples are set to die on any server returned fault.
$client->set_die_on_faults(1);
# Call the example
add_responsive_display_ad($client, $ad_group_id);
examples/v201809/advanced_operations/add_shopping_dynamic_remarketing_campaign.pl view on Meta::CPAN
}
# Don't run the example if the file is being included.
if (abs_path($0) ne abs_path(__FILE__)) {
return 1;
}
# Log SOAP XML request, response and API errors.
Google::Ads::AdWords::Logging::enable_all_logging();
# Get AdWords Client, credentials will be read from ~/adwords.properties.
my $client = Google::Ads::AdWords::Client->new({version => "v201809"});
# By default examples are set to die on any server returned fault.
$client->set_die_on_faults(1);
# Call the example
add_shopping_dynamic_remarketing_campaign($client, $merchant_id, $budget_id,
$user_list_id);
examples/v201809/advanced_operations/add_universal_app_campaign.pl view on Meta::CPAN
}
# Don't run the example if the file is being included.
if (abs_path($0) ne abs_path(__FILE__)) {
return 1;
}
# Log SOAP XML request, response and API errors.
Google::Ads::AdWords::Logging::enable_all_logging();
# Get AdWords Client, credentials will be read from ~/adwords.properties.
my $client = Google::Ads::AdWords::Client->new({version => "v201809"});
# By default examples are set to die on any server returned fault.
$client->set_die_on_faults(1);
# Call the example
add_universal_app_campaign($client);
examples/v201809/advanced_operations/create_and_attach_shared_keyword_set.pl view on Meta::CPAN
}
# Don't run the example if the file is being included.
if (abs_path($0) ne abs_path(__FILE__)) {
return 1;
}
# Log SOAP XML request, response and API errors.
Google::Ads::AdWords::Logging::enable_all_logging();
# Get AdWords Client, credentials will be read from ~/adwords.properties.
my $client = Google::Ads::AdWords::Client->new({version => "v201809"});
# By default examples are set to die on any server returned fault.
$client->set_die_on_faults(1);
# Call the example
create_and_attach_shared_keyword_set($client, $campaign_id);
examples/v201809/advanced_operations/find_and_remove_criteria_from_shared_set.pl view on Meta::CPAN
}
# Don't run the example if the file is being included.
if (abs_path($0) ne abs_path(__FILE__)) {
return 1;
}
# Log SOAP XML request, response and API errors.
Google::Ads::AdWords::Logging::enable_all_logging();
# Get AdWords Client, credentials will be read from ~/adwords.properties.
my $client = Google::Ads::AdWords::Client->new({version => "v201809"});
# By default examples are set to die on any server returned fault.
$client->set_die_on_faults(1);
# Call the example
find_and_remove_criteria_from_shared_set($client, $campaign_id);
examples/v201809/advanced_operations/get_ad_group_bid_modifier.pl view on Meta::CPAN
}
# Don't run the example if the file is being included.
if (abs_path($0) ne abs_path(__FILE__)) {
return 1;
}
# Log SOAP XML request, response and API errors.
Google::Ads::AdWords::Logging::enable_all_logging();
# Get AdWords Client, credentials will be read from ~/adwords.properties.
my $client = Google::Ads::AdWords::Client->new({version => "v201809"});
# By default examples are set to die on any server returned fault.
$client->set_die_on_faults(1);
# Call the example
get_ad_group_bid_modifier($client);
examples/v201809/advanced_operations/upload_offline_conversions.pl view on Meta::CPAN
}
# Don't run the example if the file is being included.
if (abs_path($0) ne abs_path(__FILE__)) {
return 1;
}
# Log SOAP XML request, response and API errors.
Google::Ads::AdWords::Logging::enable_all_logging();
# Get AdWords Client, credentials will be read from ~/adwords.properties.
my $client = Google::Ads::AdWords::Client->new({version => "v201809"});
# By default examples are set to die on any server returned fault.
$client->set_die_on_faults(1);
# Call the example
upload_offline_conversions($client, $conversion_name, $gclid, $conversion_time,
$conversion_value);
examples/v201809/advanced_operations/use_portfolio_bidding_strategy.pl view on Meta::CPAN
}
# Don't run the example if the file is being included.
if (abs_path($0) ne abs_path(__FILE__)) {
return 1;
}
# Log SOAP XML request, response and API errors.
Google::Ads::AdWords::Logging::enable_all_logging();
# Get AdWords Client, credentials will be read from ~/adwords.properties.
my $client = Google::Ads::AdWords::Client->new({version => "v201809"});
# By default examples are set to die on any server returned fault.
$client->set_die_on_faults(1);
# Call the example
use_portfolio_bidding_strategy($client, $budget_id);
examples/v201809/basic_operations/add_ad_groups.pl view on Meta::CPAN
}
# Don't run the example if the file is being included.
if (abs_path($0) ne abs_path(__FILE__)) {
return 1;
}
# Log SOAP XML request, response and API errors.
Google::Ads::AdWords::Logging::enable_all_logging();
# Get AdWords Client, credentials will be read from ~/adwords.properties.
my $client = Google::Ads::AdWords::Client->new({version => "v201809"});
# By default examples are set to die on any server returned fault.
$client->set_die_on_faults(1);
# Call the example
add_ad_groups($client, $campaign_id);
examples/v201809/basic_operations/add_campaigns.pl view on Meta::CPAN
}
# Don't run the example if the file is being included.
if (abs_path($0) ne abs_path(__FILE__)) {
return 1;
}
# Log SOAP XML request, response and API errors.
Google::Ads::AdWords::Logging::enable_all_logging();
# Get AdWords Client, credentials will be read from ~/adwords.properties.
my $client = Google::Ads::AdWords::Client->new({version => "v201809"});
# By default examples are set to die on any server returned fault.
$client->set_die_on_faults(1);
# Call the example
add_campaigns($client);
examples/v201809/basic_operations/add_expanded_text_ads.pl view on Meta::CPAN
}
# Don't run the example if the file is being included.
if (abs_path($0) ne abs_path(__FILE__)) {
return 1;
}
# Log SOAP XML request, response and API errors.
Google::Ads::AdWords::Logging::enable_all_logging();
# Get AdWords Client, credentials will be read from ~/adwords.properties.
my $client = Google::Ads::AdWords::Client->new({version => "v201809"});
# By default examples are set to die on any server returned fault.
$client->set_die_on_faults(1);
# Call the example
add_expanded_text_ads($client, $ad_group_id);
examples/v201809/basic_operations/add_keywords.pl view on Meta::CPAN
}
# Don't run the example if the file is being included.
if (abs_path($0) ne abs_path(__FILE__)) {
return 1;
}
# Log SOAP XML request, response and API errors.
Google::Ads::AdWords::Logging::enable_all_logging();
# Get AdWords Client, credentials will be read from ~/adwords.properties.
my $client = Google::Ads::AdWords::Client->new({version => "v201809"});
# By default examples are set to die on any server returned fault.
$client->set_die_on_faults(1);
# Call the example
add_keywords($client, $ad_group_id);
examples/v201809/basic_operations/add_responsive_search_ad.pl view on Meta::CPAN
}
# Don't run the example if the file is being included.
if (abs_path($0) ne abs_path(__FILE__)) {
return 1;
}
# Log SOAP XML request, response and API errors.
Google::Ads::AdWords::Logging::enable_all_logging();
# Get AdWords Client, credentials will be read from ~/adwords.properties.
my $client = Google::Ads::AdWords::Client->new({ version => "v201809" });
# By default examples are set to die on any server returned fault.
$client->set_die_on_faults(1);
# Call the example
add_responsive_search_ad($client, $ad_group_id);