Stay organized with collectionsSave and categorize content based on your preferences.
To create an account, send the Google Ads API a pre-populatedCustomer. Unlike creating other entities like
campaigns, this is done with a specialCreateCustomerClientmethod on theCustomerServicerather than a "mutate" method. In theCreateCustomerClientmethod, you specify the customer ID of the manager account that will be
managing the new client, not the customer ID of the client being mutated
as usual.
defmain(client:GoogleAdsClient,manager_customer_id:str)->None:"""The main method that creates all necessary entities for the example.Args:client: an initialized GoogleAdsClient instance.manager_customer_id: a manager client customer ID."""customer_service:CustomerServiceClient=client.get_service("CustomerService")customer:Customer=client.get_type("Customer")now:str=datetime.today().strftime("%Y%m%d%H:%M:%S")customer.descriptive_name=f"Account created with CustomerService on{now}"# For a list of valid currency codes and time zones see this documentation:# https://developers.google.com/google-ads/api/reference/data/codes-formatscustomer.currency_code="USD"customer.time_zone="America/New_York"# The below values are optional. For more information about URL# options see: https://support.google.com/google-ads/answer/6305348customer.tracking_url_template="{lpurl}?device={device}"customer.final_url_suffix=("keyword={keyword}&matchtype={matchtype}&adgroupid={adgroupid}")response:CreateCustomerClientResponse=(customer_service.create_customer_client(customer_id=manager_customer_id,customer_client=customer))print(f'Customer created with resource name "{response.resource_name}" 'f'under manager account with ID "{manager_customer_id}".')
defcreate_customer(manager_customer_id)# GoogleAdsClient will read a config file from# ENV['HOME']/google_ads_config.rb when called without parametersclient=Google::Ads::GoogleAds::GoogleAdsClient.newcustomer=client.resource.customerdo|c|c.descriptive_name="Account created with CustomerService on#{(Time.new.to_f*1000).to_i}"# For a list of valid currency codes and time zones, see this documentation:# https://developers.google.com/google-ads/api/reference/data/codes-formatsc.currency_code="USD"c.time_zone="America/New_York"# The below values are optional. For more information about URL options, see:# https://support.google.com/google-ads/answer/6305348c.tracking_url_template="{lpurl}?device={device}"c.final_url_suffix="keyword={keyword}&matchtype={matchtype}&adgroupid={adgroupid}"endresponse=client.service.customer.create_customer_client(customer_id:manager_customer_id,customer_client:customer)puts"Created a customer with resource name#{response.resource_name}under"+" the manager account with customer ID#{manager_customer_id}."end
subcreate_customer{my($api_client,$manager_customer_id)=@_;# Initialize a customer to be created.my$customer=Google::Ads::GoogleAds::V21::Resources::Customer->new({descriptiveName=>"Account created with CustomerService on #".uniqid(),# For a list of valid currency codes and time zones, see this documentation:# https://developers.google.com/google-ads/api/reference/data/codes-formatscurrencyCode=>"USD",timeZone=>"America/New_York",# The below values are optional. For more information about URL options, see:# https://support.google.com/google-ads/answer/6305348trackingUrlTemplate=>"{lpurl}?device={device}",finalUrlSuffix=>"keyword={keyword}&matchtype={matchtype}&adgroupid={adgroupid}"});# Create the customer client.my$create_customer_client_response=$api_client->CustomerService()->create_customer_client({customerId=>$manager_customer_id,customerClient=>$customer});printf"Created a customer with resource name '%s' under the manager account "."with customer ID %d.\n",$create_customer_client_response->{resourceName},$manager_customer_id;return1;}
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-03 UTC."],[[["\u003cp\u003eNew Google Ads accounts are created using the \u003ccode\u003eCreateCustomerClient\u003c/code\u003e method within the \u003ccode\u003eCustomerService\u003c/code\u003e, specifying the managing account's ID.\u003c/p\u003e\n"],["\u003cp\u003eA pre-populated \u003ccode\u003eCustomer\u003c/code\u003e object is required, containing details like descriptive name, currency, timezone, and optional URL tracking parameters.\u003c/p\u003e\n"],["\u003cp\u003eThis process differs from creating other Google Ads entities which utilize "mutate" methods instead of the dedicated \u003ccode\u003eCreateCustomerClient\u003c/code\u003e approach.\u003c/p\u003e\n"]]],[],null,[]]