Hi Google Ads Team, 

Thanks for posting this tutorial 
<https://developers.google.com/google-ads/api/docs/remarketing/audience-types/customer-match>
 
and I tried to follow every step to add users to customer match user List. 
My problem came with the huge volume of customers. I have around 1M+ users 
want to upload to that user List and here's my code to build the operation 
list.

10k users adding to the operation list takes around 7mins and it seems too 
slow. Any code improvement and opinion will be appreciated!

def _build_offline_user_data_job_operations(df):
    size = df.shape[0]
    operations_list = []
    for i in range(0, size-1, 50000):
        operations = []
        df_copy = df.iloc[i:min(size, i+50000)]
        for row in df_copy.itertuples():
            
operations.append(_build_single_offline_user_data_job_operation(row[1], 
row[2], row[3], row[4], row[5], row[6]))
        operations_list.append(operations)
    return operations_list
        

def _build_single_offline_user_data_job_operation( email, first_name, 
last_name, postal_code, country_code,  phone_number):

    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)
    user_identifier.hashed_phone_number = _normalize_and_hash(phone_number)
    address_info = client.get_type('OfflineUserAddressInfo')
    address_info.hashed_first_name = _normalize_and_hash(first_name)
    address_info.hashed_last_name = _normalize_and_hash(last_name)
    address_info.country_code = country_code 
    address_info.postal_code = postal_code 
    
    user_identifier.address_info = address_info 
    user_data.user_identifiers.append(user_identifier)
    return user_data

-- 
-- 
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
Also find us on our blog:
https://googleadsdeveloper.blogspot.com/
=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~

You received this message because you are subscribed to the Google
Groups "AdWords API and Google Ads API Forum" group.
To post to this group, send email to adwords-api@googlegroups.com
To unsubscribe from this group, send email to
adwords-api+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/adwords-api?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Google Ads API and AdWords API Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to adwords-api+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/adwords-api/32652ba9-1391-4e84-bd0a-670ae6cfd09an%40googlegroups.com.
  • Ho... Lin Chen
    • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum
      • ... Lin Chen
        • ... 'Google Ads API Forum Advisor' via Google Ads API and AdWords API Forum

Reply via email to