Skip to content

Commit ea934ca

Browse files
authored
Changes for release v19_1. (#930)
1 parent bbe1466 commit ea934ca

File tree

1,551 files changed

+5514
-2334
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,551 files changed

+5514
-2334
lines changed

ChangeLog

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
* 26.1.0
2+
- Google Ads API v19_1 release.
3+
- Add two new examples for budget recommendations.
4+
- Fix bug in normalize_and_hash function in enhanced conversions examples.
5+
- Update enhanced conversions for leads example to include session attributes.
6+
17
* 26.0.1
28
- Rename constraints file to resolve install issues on Windows
39
- Update add_customer_match_user_list.py to remove mention of unlimited list expiry (#921)

examples/remarketing/upload_enhanced_conversions_for_leads.py

Lines changed: 67 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ def main(
3939
order_id,
4040
gclid,
4141
ad_user_data_consent,
42+
session_attributes_encoded=None,
43+
session_attributes_dict=None,
4244
):
4345
"""The main method that creates all necessary entities for the example.
4446
@@ -52,7 +54,19 @@ def main(
5254
gclid: The Google click ID for the click.
5355
ad_user_data_consent: The consent status for ad user data for all
5456
members in the job.
57+
session_attributes_encoded: a str token of encoded session atttributes.
58+
Only one of session_attributes_encoded or session_attributes_dict
59+
should be passed.
60+
session_attributes_dict: a dict[str, str] of session attribute
61+
key value pairs. Only one of session_attributes_encoded or
62+
session_attributes_dict should be passed.
5563
"""
64+
if session_attributes_encoded and session_attributes_dict:
65+
raise ValueError(
66+
"Only one of 'session_attributes_encoded' or "
67+
"'session_attributes_dict' can be set."
68+
)
69+
5670
# [START add_user_identifiers]
5771
# Extract user email and phone from the raw data, normalize and hash it,
5872
# then wrap it in UserIdentifier objects. Create a separate UserIdentifier
@@ -146,7 +160,22 @@ def main(
146160
click_conversion.consent.ad_user_data = client.enums.ConsentStatusEnum[
147161
raw_record["ad_user_data_consent"]
148162
]
149-
# [END add_conversion_details]
163+
164+
# [START add_session_attributes]
165+
# Set one of the session_attributes_encoded or
166+
# session_attributes_key_value_pairs fields if either are provided.
167+
if session_attributes_encoded:
168+
click_conversion.session_attributes_encoded = session_attributes_encoded
169+
elif session_attributes_dict:
170+
for key, value in session_attributes_dict.items():
171+
pair = client.get_type("SessionAttributeKeyValuePair")
172+
pair.session_attribute_key = key
173+
pair.session_attribute_value = value
174+
click_conversion.session_attributes_key_value_pairs.key_value_pairs.append(
175+
pair
176+
)
177+
# [END add_session_attributes]
178+
# [END add_conversion_details]
150179

151180
# [START upload_conversion]
152181
# Creates the conversion upload service client.
@@ -230,6 +259,10 @@ def normalize_and_hash(s):
230259

231260

232261
if __name__ == "__main__":
262+
# GoogleAdsClient will read the google-ads.yaml configuration file in the
263+
# home directory if none is specified.
264+
googleads_client = GoogleAdsClient.load_from_storage(version="v19")
265+
233266
parser = argparse.ArgumentParser(
234267
description="Imports offline call conversion values for calls related "
235268
"to your ads."
@@ -278,7 +311,7 @@ def normalize_and_hash(s):
278311
help="the Google click ID (gclid) for the click.",
279312
)
280313
parser.add_argument(
281-
"-d",
314+
"-n",
282315
"--ad_user_data_consent",
283316
type=str,
284317
choices=[e.name for e in googleads_client.enums.ConsentStatusEnum],
@@ -287,11 +320,35 @@ def normalize_and_hash(s):
287320
"the job."
288321
),
289322
)
323+
# A mutually exclusive group means that session_attributes_encoded and
324+
# session_attributes_key_value_pairs cannot be passed in at the same time.
325+
session_attributes = parser.add_mutually_exclusive_group()
326+
session_attributes.add_argument(
327+
"-e",
328+
"--session_attributes_encoded",
329+
type=str,
330+
default=None,
331+
help=("A session attributes token."),
332+
)
333+
session_attributes.add_argument(
334+
"-k",
335+
"--session_attributes_key_value_pairs",
336+
nargs="+",
337+
type=str,
338+
default=None,
339+
help=(
340+
"A space-delimited list of session attribute key value pairs. Each "
341+
"pair should be separated by an equal sign, for example: "
342+
"'-k gad_campaignid=12345 gad_source=1'"
343+
),
344+
)
290345
args = parser.parse_args()
291346

292-
# GoogleAdsClient will read the google-ads.yaml configuration file in the
293-
# home directory if none is specified.
294-
googleads_client = GoogleAdsClient.load_from_storage(version="v19")
347+
if args.session_attributes_key_value_pairs:
348+
# Convert the string-based input to a dict
349+
session_attributes_dict = dict(
350+
pair.split("=") for pair in args.session_attributes_key_value_pairs
351+
)
295352

296353
try:
297354
main(
@@ -303,6 +360,11 @@ def normalize_and_hash(s):
303360
args.order_id,
304361
args.gclid,
305362
args.ad_user_data_consent,
363+
# Only one of 'session_attributes_encoded' or
364+
# 'session_attributes_dict' can be passed at a time. If both are
365+
# passed the example will fail with a ValueError.
366+
session_attributes_encoded=args.session_attributes_encoded,
367+
session_attributes_dict=session_attributes_dict,
306368
)
307369
except GoogleAdsException as ex:
308370
print(

google/ads/googleads/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@
1919
import google.ads.googleads.errors
2020
import google.ads.googleads.util
2121

22-
VERSION = "26.0.1"
22+
VERSION = "26.1.0"

google/ads/googleads/v19/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright 2024 Google LLC
2+
# Copyright 2025 Google LLC
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.

google/ads/googleads/v19/common/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright 2024 Google LLC
2+
# Copyright 2025 Google LLC
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -59,6 +59,7 @@
5959
from .types.ad_type_infos import VideoOutstreamAdInfo
6060
from .types.ad_type_infos import VideoResponsiveAdInfo
6161
from .types.ad_type_infos import VideoTrueViewInStreamAdInfo
62+
from .types.ad_type_infos import YouTubeAudioAdInfo
6263
from .types.asset_policy import AdAssetPolicySummary
6364
from .types.asset_policy import AssetDisapproved
6465
from .types.asset_policy import AssetLinkPrimaryStatusDetails
@@ -633,6 +634,7 @@
633634
"WhatsappBusinessMessageInfo",
634635
"YearMonth",
635636
"YearMonthRange",
637+
"YouTubeAudioAdInfo",
636638
"YouTubeChannelAttributeMetadata",
637639
"YouTubeChannelInfo",
638640
"YouTubeVideoAttributeMetadata",

google/ads/googleads/v19/common/services/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright 2024 Google LLC
2+
# Copyright 2025 Google LLC
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.

google/ads/googleads/v19/common/types/__init__.py

Lines changed: 51 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright 2024 Google LLC
2+
# Copyright 2025 Google LLC
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -57,6 +57,7 @@
5757
VideoOutstreamAdInfo,
5858
VideoResponsiveAdInfo,
5959
VideoTrueViewInStreamAdInfo,
60+
YouTubeAudioAdInfo,
6061
)
6162
from .asset_policy import (
6263
AdAssetPolicySummary,
@@ -116,7 +117,9 @@
116117
WhatsappBusinessMessageInfo,
117118
YoutubeVideoAsset,
118119
)
119-
from .asset_usage import AssetUsage
120+
from .asset_usage import (
121+
AssetUsage,
122+
)
120123
from .audience_insights_attribute import (
121124
AudienceInsightsAttribute,
122125
AudienceInsightsAttributeMetadata,
@@ -168,8 +171,12 @@
168171
TargetRoas,
169172
TargetSpend,
170173
)
171-
from .click_location import ClickLocation
172-
from .consent import Consent
174+
from .click_location import (
175+
ClickLocation,
176+
)
177+
from .consent import (
178+
Consent,
179+
)
173180
from .criteria import (
174181
ActivityCityInfo,
175182
ActivityCountryInfo,
@@ -251,8 +258,12 @@
251258
CriterionCategoryChannelAvailability,
252259
CriterionCategoryLocaleAvailability,
253260
)
254-
from .custom_parameter import CustomParameter
255-
from .customizer_value import CustomizerValue
261+
from .custom_parameter import (
262+
CustomParameter,
263+
)
264+
from .customizer_value import (
265+
CustomizerValue,
266+
)
256267
from .dates import (
257268
DateRange,
258269
YearMonth,
@@ -263,8 +274,12 @@
263274
CalloutFeedItem,
264275
SitelinkFeedItem,
265276
)
266-
from .feed_common import Money
267-
from .final_app_url import FinalAppUrl
277+
from .feed_common import (
278+
Money,
279+
)
280+
from .final_app_url import (
281+
FinalAppUrl,
282+
)
268283
from .frequency_cap import (
269284
FrequencyCapEntry,
270285
FrequencyCapKey,
@@ -280,9 +295,15 @@
280295
KeywordPlanHistoricalMetrics,
281296
MonthlySearchVolume,
282297
)
283-
from .lifecycle_goals import LifecycleGoalValueSettings
284-
from .local_services import LocalServicesDocumentReadOnly
285-
from .metric_goal import MetricGoal
298+
from .lifecycle_goals import (
299+
LifecycleGoalValueSettings,
300+
)
301+
from .local_services import (
302+
LocalServicesDocumentReadOnly,
303+
)
304+
from .metric_goal import (
305+
MetricGoal,
306+
)
286307
from .metrics import (
287308
Metrics,
288309
SearchVolumeRange,
@@ -309,8 +330,12 @@
309330
PolicyValidationParameter,
310331
PolicyViolationKey,
311332
)
312-
from .policy_summary import PolicySummary
313-
from .real_time_bidding_setting import RealTimeBiddingSetting
333+
from .policy_summary import (
334+
PolicySummary,
335+
)
336+
from .real_time_bidding_setting import (
337+
RealTimeBiddingSetting,
338+
)
314339
from .segments import (
315340
AssetInteractionTarget,
316341
BudgetCampaignAssociationStatus,
@@ -334,14 +359,20 @@
334359
TargetRoasSimulationPoint,
335360
TargetRoasSimulationPointList,
336361
)
337-
from .tag_snippet import TagSnippet
362+
from .tag_snippet import (
363+
TagSnippet,
364+
)
338365
from .targeting_setting import (
339366
TargetingSetting,
340367
TargetRestriction,
341368
TargetRestrictionOperation,
342369
)
343-
from .text_label import TextLabel
344-
from .url_collection import UrlCollection
370+
from .text_label import (
371+
TextLabel,
372+
)
373+
from .url_collection import (
374+
UrlCollection,
375+
)
345376
from .user_lists import (
346377
BasicUserListInfo,
347378
CrmBasedUserListInfo,
@@ -361,7 +392,9 @@
361392
UserListRuleItemInfo,
362393
UserListStringRuleItemInfo,
363394
)
364-
from .value import Value
395+
from .value import (
396+
Value,
397+
)
365398

366399
__all__ = (
367400
"AdAppDeepLinkAsset",
@@ -405,6 +438,7 @@
405438
"VideoOutstreamAdInfo",
406439
"VideoResponsiveAdInfo",
407440
"VideoTrueViewInStreamAdInfo",
441+
"YouTubeAudioAdInfo",
408442
"AdAssetPolicySummary",
409443
"AssetDisapproved",
410444
"AssetLinkPrimaryStatusDetails",

google/ads/googleads/v19/common/types/ad_asset.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright 2024 Google LLC
2+
# Copyright 2025 Google LLC
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.

google/ads/googleads/v19/common/types/ad_type_infos.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright 2024 Google LLC
2+
# Copyright 2025 Google LLC
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.
@@ -48,6 +48,7 @@
4848
"VideoTrueViewInStreamAdInfo",
4949
"VideoOutstreamAdInfo",
5050
"InFeedVideoAdInfo",
51+
"YouTubeAudioAdInfo",
5152
"VideoAdInfo",
5253
"VideoResponsiveAdInfo",
5354
"ResponsiveSearchAdInfo",
@@ -515,6 +516,10 @@ class InFeedVideoAdInfo(proto.Message):
515516
)
516517

517518

519+
class YouTubeAudioAdInfo(proto.Message):
520+
r"""Representation of YouTube Audio ad format."""
521+
522+
518523
class VideoAdInfo(proto.Message):
519524
r"""A video ad.
520525
@@ -547,6 +552,10 @@ class VideoAdInfo(proto.Message):
547552
in_feed (google.ads.googleads.v19.common.types.InFeedVideoAdInfo):
548553
In-feed video ad format.
549554
555+
This field is a member of `oneof`_ ``format``.
556+
audio (google.ads.googleads.v19.common.types.YouTubeAudioAdInfo):
557+
YouTube Audio ad format.
558+
550559
This field is a member of `oneof`_ ``format``.
551560
"""
552561

@@ -585,6 +594,12 @@ class VideoAdInfo(proto.Message):
585594
oneof="format",
586595
message="InFeedVideoAdInfo",
587596
)
597+
audio: "YouTubeAudioAdInfo" = proto.Field(
598+
proto.MESSAGE,
599+
number=10,
600+
oneof="format",
601+
message="YouTubeAudioAdInfo",
602+
)
588603

589604

590605
class VideoResponsiveAdInfo(proto.Message):

google/ads/googleads/v19/common/types/asset_policy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright 2024 Google LLC
2+
# Copyright 2025 Google LLC
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.

google/ads/googleads/v19/common/types/asset_set_types.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# -*- coding: utf-8 -*-
2-
# Copyright 2024 Google LLC
2+
# Copyright 2025 Google LLC
33
#
44
# Licensed under the Apache License, Version 2.0 (the "License");
55
# you may not use this file except in compliance with the License.

0 commit comments

Comments
 (0)