Skip to content

Commit

Permalink
Changes for release v13_1. (#105)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurachevalier4 authored Apr 28, 2023
1 parent 5f9d8ae commit 5c2706f
Show file tree
Hide file tree
Showing 46 changed files with 1,146 additions and 79 deletions.
2 changes: 1 addition & 1 deletion Build.PL
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ $build_sc->new(
create_makefile_pl => "traditional",
dist_abstract => "Google Ads API Client Library for Perl",
dist_name => "Google-Ads-GoogleAds-Client",
dist_version => "16.0.0",
dist_version => "16.1.0",
requires => {
"Class::Load" => 0,
"Class::Std::Fast" => 0,
Expand Down
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
16.1.0 - 2023-04-28
-------------------
- Added support for Google Ads API v13.1.
- Added code example: add_things_to_do_ad.
- Renamed hotel directory to travel.
- Updated examples: upload_conversion_enhancement, add_call_ad,
add_smart_campaign, add_call, add_customer_match_user_list,
upload_call_conversion, upload_conversion_enhancement,
upload_store_sales_transactions.

16.0.0 - 2023-03-31
-------------------
- Removed support for Google Ads API v11.
Expand Down
2 changes: 1 addition & 1 deletion examples/advanced_operations/add_call_ad.pl
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ =head1 SYNOPSIS
-customer_id The Google Ads customer ID.
-ad_group_id The ad group ID to add a call ad to.
-phone_country [optional] The phone country (2-letter code).
-phone_number The raw phone number, e.g. "(123) 456-7890".
-phone_number The raw phone number, e.g. "(800) 555-0100".
-conversion_action_id [optional] The conversion action ID to attribute conversions to.
=cut
2 changes: 1 addition & 1 deletion examples/advanced_operations/add_smart_campaign.pl
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
# https://developers.google.com/google-ads/api/reference/data/codes-formats#expandable-7
use constant LANGUAGE_CODE => "en";
use constant LANDING_PAGE_URL => "http://www.example.com";
use constant PHONE_NUMBER => "555-555-5555";
use constant PHONE_NUMBER => "800-555-0100";
use constant BUDGET_TEMPORARY_ID => -1;
use constant SMART_CAMPAIGN_TEMPORARY_ID => -2;
use constant AD_GROUP_TEMPORARY_ID => -3;
Expand Down
2 changes: 1 addition & 1 deletion examples/extensions/add_call.pl
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ =head1 SYNOPSIS
-help Show the help message.
-customer_id The Google Ads customer ID.
-phone_country [optional] The phone country (2-letter code).
-phone_number The raw phone number, e.g. "(123) 456-7890".
-phone_number The raw phone number, e.g. "(800) 555-0100".
-conversion_action_id [optional] The conversion action ID to attribute conversions to.
=cut
16 changes: 8 additions & 8 deletions examples/remarketing/add_customer_match_user_list.pl
Original file line number Diff line number Diff line change
Expand Up @@ -287,30 +287,30 @@ ()
# [START add_customer_match_user_list_2]
# The first user data has an email address and a phone number.
my $raw_record_1 = {
email => 'test@gmail.com',
email => 'dana@example.com',
# Phone number to be converted to E.164 format, with a leading '+' as
# required. This includes whitespace that will be removed later.
phone => '+1 234 5678910',
phone => '+1 800 5550101',
};

# The second user data has an email address, a mailing address, and a phone
# number.
my $raw_record_2 = {
# Email address that includes a period (.) before the Gmail domain.
email => 'test.2@gmail.com',
email => 'alex.2@example.com',
# Address that includes all four required elements: first name, last
# name, country code, and postal code.
firstName => 'John',
lastName => 'Doe',
firstName => 'Alex',
lastName => 'Quinn',
countryCode => 'US',
postalCode => '10011',
postalCode => '94045',
# Phone number to be converted to E.164 format, with a leading '+' as
# required.
phone => '+1 234 5678910',
phone => '+1 800 5550102',
};

# The third user data only has an email address.
my $raw_record_3 = {email => 'test3@gmail.com',};
my $raw_record_3 = {email => 'charlie@example.com',};

my $raw_records = [$raw_record_1, $raw_record_2, $raw_record_3];

Expand Down
2 changes: 1 addition & 1 deletion examples/remarketing/upload_call_conversion.pl
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ =head1 SYNOPSIS
-customer_id The Google Ads customer ID.
-conversion_action_id The ID of the conversion action to upload to.
-caller_id The caller ID from which this call was placed. Caller ID is expected to be
in E.164 format with preceding '+' sign. e.g. "+16502531234".
in E.164 format with preceding '+' sign. e.g. "+18005550100".
-call_start_date_time The date and time at which the call occurred.
The format is "yyyy-mm-dd hh:mm:ss+|-hh:mm", e.g. "2019-01-01 12:32:45-08:00".
-conversion_date_time The date and time of the conversion (should be after the call time).
Expand Down
48 changes: 8 additions & 40 deletions examples/remarketing/upload_conversion_enhancement.pl
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@
Google::Ads::GoogleAds::V13::Services::ConversionAdjustmentUploadService::ConversionAdjustment;
use
Google::Ads::GoogleAds::V13::Services::ConversionAdjustmentUploadService::GclidDateTimePair;
use
Google::Ads::GoogleAds::V13::Services::ConversionAdjustmentUploadService::RestatementValue;
use Google::Ads::GoogleAds::V13::Utils::ResourceNames;

use Getopt::Long qw(:config auto_help);
Expand All @@ -55,19 +53,15 @@
my $customer_id = "INSERT_CUSTOMER_ID_HERE";
my $conversion_action_id = "INSERT_CONVERSION_ACTION_ID_HERE";
my $order_id = "INSERT_ORDER_ID_HERE";
# Optional: Specify the conversion date/time, user agent restatement value and
# restatement currency code.
# Optional: Specify the conversion date/time and user agent.
my $conversion_date_time = undef;
my $user_agent = undef;
my $restatement_value = undef;
my $currency_code = undef;

# [START upload_conversion_enhancement]
sub upload_conversion_enhancement {
my (
$api_client, $customer_id, $conversion_action_id,
$order_id, $conversion_date_time, $user_agent,
$restatement_value, $currency_code
$api_client, $customer_id, $conversion_action_id,
$order_id, $conversion_date_time, $user_agent
) = @_;

# [START create_adjustment]
Expand Down Expand Up @@ -101,8 +95,8 @@ sub upload_conversion_enhancement {
Google::Ads::GoogleAds::V13::Common::UserIdentifier->new({
addressInfo =>
Google::Ads::GoogleAds::V13::Common::OfflineUserAddressInfo->new({
hashedFirstName => normalize_and_hash("Joanna"),
hashedLastName => normalize_and_hash("Smith"),
hashedFirstName => normalize_and_hash("Dana"),
hashedLastName => normalize_and_hash("Quinn"),
hashedStreetAddress => normalize_and_hash("1600 Amphitheatre Pkwy"),
city => "Mountain View",
state => "CA",
Expand All @@ -119,8 +113,7 @@ sub upload_conversion_enhancement {
Google::Ads::GoogleAds::V13::Common::UserIdentifier->new({
userIdentifierSource => FIRST_PARTY,
# Use the normalize and hash method specifically for email addresses.
hashedEmail => normalize_and_hash_email_address('[email protected]')
});
hashedEmail => normalize_and_hash_email_address('[email protected]')});

# Add the user identifiers to the enhancement adjustment.
$enhancement->{userIdentifiers} = [$address_identifier, $email_identifier];
Expand All @@ -134,26 +127,6 @@ sub upload_conversion_enhancement {
$enhancement->{userAgent} = $user_agent;
}

if (defined $restatement_value) {
# Construct the restated conversion value.
my $value =
Google::Ads::GoogleAds::V13::Services::ConversionAdjustmentUploadService::RestatementValue
->new({
# Set the new value of the conversion.
adjustedValue => $restatement_value
});

# Set the currency of the new value, if provided. Otherwise, the default
# currency from the conversion action is used, and if that is not set then
# the account currency is used.
if (defined $currency_code) {
$value->{currencyCode} = $currency_code;
}

$enhancement->{restatementValue} = $value;
}
# [END create_adjustment]

# Upload the enhancement adjustment. Partial failure should always be set to true.
my $response =
$api_client->ConversionAdjustmentUploadService()
Expand Down Expand Up @@ -227,9 +200,7 @@ sub normalize_and_hash_email_address {
"conversion_action_id=i" => \$conversion_action_id,
"order_id=s" => \$order_id,
"conversion_date_time=s" => \$conversion_date_time,
"user_agent=s" => \$user_agent,
"restatement_value=f" => \$restatement_value,
"currency_code=s" => \$currency_code
"user_agent=s" => \$user_agent
);

# Print the help message if the parameters are not initialized in the code nor
Expand All @@ -239,8 +210,7 @@ sub normalize_and_hash_email_address {

# Call the example.
upload_conversion_enhancement($api_client, $customer_id =~ s/-//gr,
$conversion_action_id, $order_id, $conversion_date_time, $user_agent,
$restatement_value, $currency_code);
$conversion_action_id, $order_id, $conversion_date_time, $user_agent);

=pod
Expand All @@ -266,7 +236,5 @@ =head1 SYNOPSIS
The format is "yyyy-mm-dd hh:mm:ss+|-hh:mm", e.g. "2019-01-01 12:32:45-08:00".
Setting this field is optional, but recommended.
-user_agent [optional] The HTTP user agent of the conversion.
-restatement_value [optional] The enhancement value.
-currency_code [optional] The currency of the enhancement value.
=cut
6 changes: 3 additions & 3 deletions examples/remarketing/upload_store_sales_transactions.pl
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ sub build_offline_user_data_job_operations {
userIdentifiers => [
Google::Ads::GoogleAds::V13::Common::UserIdentifier->new({
# Hash normalized email addresses based on SHA-256 hashing algorithm.
hashedEmail => normalize_and_hash('customer@example.com')}
hashedEmail => normalize_and_hash('dana@example.com')}
),
Google::Ads::GoogleAds::V13::Common::UserIdentifier->new({
addressInfo =>
Expand Down Expand Up @@ -368,8 +368,8 @@ sub build_offline_user_data_job_operations {
addressInfo =>
Google::Ads::GoogleAds::V13::Common::OfflineUserAddressInfo->new({
# First and last name must be normalized and hashed.
hashedFirstName => normalize_and_hash("John"),
hashedLastName => normalize_and_hash("Doe"),
hashedFirstName => normalize_and_hash("Dana"),
hashedLastName => normalize_and_hash("Quinn"),
# Country code and zip code are sent in plain text.
countryCode => "US",
postalCode => "10011"
Expand Down
File renamed without changes.
Loading

0 comments on commit 5c2706f

Please sign in to comment.