GOOGLE-ADWORDS-PERL-CLIENT
view release on metacpan or search on metacpan
examples/v201309/basic_operations/add_ad_groups.pl view on Meta::CPAN
microAmount => 1000000
}),
contentBid => Google::Ads::AdWords::v201309::Money->new({
microAmount => 750000
}),
}),
]
}),
# Additional properties (non-required).
status => "ENABLED",
settings => [
# Targetting restriction settings - these setting only affect serving
# for the Display Network.
Google::Ads::AdWords::v201309::TargetingSetting->new({
details => [
# Restricting to serve ads that match your ad group placements.
Google::Ads::AdWords::v201309::TargetingSettingDetail->new({
criterionTypeGroup => "PLACEMENT",
targetAll => 1
}),
# Using your ad group verticals only for bidding.
Google::Ads::AdWords::v201309::TargetingSettingDetail->new({
criterionTypeGroup => "VERTICAL",
targetAll => 0
})
]
})
]
});
# Create operation.
my $ad_group_operation =
Google::Ads::AdWords::v201309::AdGroupOperation->new({
operator => "ADD",
operand => $ad_group
});
push @operations, $ad_group_operation;
}
# Add ad groups.
my $result = $client->AdGroupService()->mutate({
operations => \@operations
});
# Display ad groups.
foreach my $ad_group (@{$result->get_value()}) {
printf "Ad group with name \"%s\" and id \"%d\" was added.\n",
$ad_group->get_name(), $ad_group->get_id();
}
return 1;
}
# 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 => "v201309"});
# 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);
( run in 0.837 second using v1.01-cache-2.11-cpan-75ffa21a3d4 )