Adding Consent Field To OfflineUserDataJobOperation Job
masabni opened this issue · 4 comments
Whenever I try to add the consent field to the user data operation I get this error
[ERROR] AttributeError: consent
this is how I'm doing it in the code
user_data_operation = client.get_type('OfflineUserDataJobOperation')
user_data = user_data_operation.create
user_identifier = client.get_type('UserIdentifier')
user_identifier.hashed_email = normalize_and_hash(email)
# add GRANTED consent for the user (2 is the enum value for GRANTED)
user_data.consent.ad_user_data = 2
user_data.consent.ad_personalization = 2
it looks like that doing it like user_data.consent.ad_user_data = 2
is not the correct way, I didn't find much documentation about this anywhere except for the examples and even there it's similar to my code.
Can you please tell me what I'm doing wrong here, thanks in advance
@BenRKarl it looks like I have the latest version of the package but still it gives error when accessing the consent attribute from the metadata
offline_user_data_job = client.get_type("OfflineUserDataJob")
offline_user_data_job.customer_match_user_list_metadata.consent.ad_user_data = (
client.enums.ConsentStatusEnum.GRANTED
)
are you sure the latest version has this attribute? can you confirm the version i need to use for this package, currently I'm using
google-ads
google-api-python-client
packages