创建账号 | Google Ads API | Google for Developers


本站和网页 https://developers.google.cn/google-ads/api/docs/account-management/create-account?hl=zh-cn 的作者无关,不对其内容负责。快照谨为网络故障时之索引,不代表被搜索网站的即时页面。

创建账号 | Google Ads API | Google for Developers
Google
Ads API
English
Deutsch
Español
Español – América Latina
Français
Indonesia
Italiano
Polski
Português – Brasil
Tiếng Việt
Türkçe
Русский
עברית
العربيّة
فارسی
हिंदी
বাংলা
ภาษาไทย
中文 – 简体
中文 – 繁體
日本語
한국어
指南
视频
参考
报告
库和示例
REST 接口
政策
支持
Google
Ads API
指南
视频
参考
报告
库和示例
REST 接口
政策
支持
概览
开始使用
简介获取开发者令牌设置 Google API 控制台项目准备 Google Ads 帐号下载工具和库进行 API 调用常见错误
基本概念
概览API 结构实体关系版本控制更改和检查对象检索对象资源元数据调用结构
转变
概览资源转变批量转变最佳实践云管理的访问权限级别
账号管理
概览创建帐号与经理帐号相关联列出可访问的帐号获取帐号层次结构管理用户访问权限管理用户访问权限邀请变更状态更改事件
广告管理
概览广告类型制作广告转变广告自适应搜索广告自定义
升级版网址
概览字段支持的实体升级版网址的 Valuetrack 参数报告投放网址扩展规则
动态搜索广告
概览制作动态搜索广告DSA page feeds报告
酒店广告
概览制作广告系列制作广告组制作广告创建产品信息组
出价
概览分配策略设置出价调整出价报告
推荐活动广告
概览制作广告系列制作广告组制作广告创建产品信息组报告
自适应展示广告
概览制作广告检索广告
自适应搜索广告
概览制作广告检索广告
购物广告
概览关联 Merchant Center制作广告系列制作广告组制作广告创建产品信息组报告
上传的展示广告
概览制作上传的展示广告已上传的 HTML5 广告
素材资源
概览创建和使用地址素材资源自动生成的素材资源报告
授权
概览Cloud 项目客户端库服务账号凭据管理内部原理两步验证游乐园
结算
概览结算设置帐号预算账单
广告系列管理
概览创建广告系列制作广告组
预算
概览创建预算共享预算分配预算移除预算跟踪效果限制和错误
出价
概览策略类型策略状态组合出价策略和标准出价策略跨帐号出价策略广告组级定位条件替换值手动设置出价管理出价调节系数创建季节性调整创建数据排除对象本地生活服务广告系列
应用广告系列
概览制作广告系列制作广告组和广告代码示例报告广告系列草稿
实验
概览创建实验创建实验组实验操作生成实验报告异步错误迁移
发现广告系列
概览制作广告系列报告与优化
效果最大化广告系列
开始使用
概览
简介零售旅行目标
广告系列设置
创建预算制作广告系列转化目标创建广告系列定位条件
素材资源组设置
素材资源素材资源要求素材资源组素材资源组信号产品信息组(零售)报告ValueTrack 参数优化和问题排查互动式指南反馈
智能广告系列
概览获取建议创建预算制作广告系列和广告系列设置创建广告系列定位条件制作广告组和广告组广告发送转变请求报告优化
转化管理
概览创建转化操作其他转化操作类型上传点击转化数据上传致电转化数据上传转化调整
增强型转化
概览
Web
设置实现问题排查
潜在客户
设置实现问题排查上传实体店销售转化数据自定义转化变量监控离线数据诊断信息转化价值规则与界面指标的对应关系
转化目标
概览客户目标广告系列目标生命周期目标
规划服务
概览生成关键字提示生成广告组主题生成历史指标生成预测指标
出价模拟
概览前提条件获取出价结果模拟信息
覆盖面预测
概览概念身份验证指定媒体策划方案生成曲线
受众群体管理
概览受众群体
细分受众群
开始使用您网站的访问者特定网页的访问者采取了具体操作的访问者多个用户列表类似受众群体
目标客户匹配
开始使用管理排查问题自定义受众群体相似细分受众群
示例场景
概览创建规则项目组创建用户列表代码示例
动态再营销
概览前提条件基于素材资源的动态再营销基于 Merchant Center 的动态再营销
报告
概览用例条件指标分割零指标标签流式Paging界面中的报告使用报告字段映射 valuetrack 参数
查询语言
概览查询语法查询结构日期范围区分大小写对结果进行排序和限制交互式查询构建器查询验证器查询实战宝典
定位
概览条件出价调节系数地理位置定位定位设置
运营
批量处理
概览使用流程使用临时 ID产品信息组过滤条件最佳做法和限制
最佳实践
概览日志记录监控API 限制和配额系统限制速率限制问题排查测试测试帐户错误类型常见错误部分失败警告开发者令牌重置
政策豁免申请
概览Ads关键字
此页面由 Cloud Translation API 翻译。
Switch to English
首页
产品
Google Ads API
创建账号
如需创建帐号,请向 Google Ads API 发送预先填充的 Customer。与创建广告系列等其他实体不同,此操作是通过针对 CustomerService 使用特殊的 CreateCustomerClient 方法(而不是“mutate”方法)完成的。在 CreateCustomerClient 方法中,您要指定将管理新客户帐号的客户 ID,而不是照常进行变更的客户帐号的客户 ID。
下面是演示如何创建客户的代码:
Java
private void runExample(GoogleAdsClient googleAdsClient, Long managerId) {
// Formats the current date/time to use as a timestamp in the new customer description.
String dateTime = ZonedDateTime.now().format(DateTimeFormatter.RFC_1123_DATE_TIME);
// Initializes a Customer object to be created.
Customer customer =
Customer.newBuilder()
.setDescriptiveName("Account created with CustomerService on '" + dateTime + "'")
.setCurrencyCode("USD")
.setTimeZone("America/New_York")
// Optional: Sets additional attributes of the customer.
.setTrackingUrlTemplate("{lpurl}?device={device}")
.setFinalUrlSuffix("keyword={keyword}&matchtype={matchtype}&adgroupid={adgroupid}")
.build();
// Sends the request to create the customer.
try (CustomerServiceClient client =
googleAdsClient.getLatestVersion().createCustomerServiceClient()) {
CreateCustomerClientResponse response =
client.createCustomerClient(managerId.toString(), customer);
System.out.printf(
"Created a customer with resource name '%s' under the manager account with"
+ " customer ID '%d'.%n",
response.getResourceName(), managerId);
}CreateCustomer.java
C#
public void Run(GoogleAdsClient client, long managerCustomerId)
// Get the CustomerService.
CustomerServiceClient customerService = client.GetService(Services.V15.CustomerService);
Customer customer = new Customer()
DescriptiveName = $"Account created with CustomerService on '{DateTime.Now}'",
// For a list of valid currency codes and time zones see this documentation:
// https://developers.google.com/google-ads/api/reference/data/codes-formats#codes_formats.
CurrencyCode = "USD",
TimeZone = "America/New_York",
// The below values are optional. For more information about URL
// options see: https://support.google.com/google-ads/answer/6305348.
TrackingUrlTemplate = "{lpurl}?device={device}",
FinalUrlSuffix = "keyword={keyword}&matchtype={matchtype}&adgroupid={adgroupid}"
};
try
// Create the account.
CreateCustomerClientResponse response = customerService.CreateCustomerClient(
managerCustomerId.ToString(), customer);
// Display the result.
Console.WriteLine($"Created a customer with resource name " +
$"'{response.ResourceName}' under the manager account with customer " +
$"ID '{managerCustomerId}'");
catch (GoogleAdsException e)
Console.WriteLine("Failure:");
Console.WriteLine($"Message: {e.Message}");
Console.WriteLine($"Failure: {e.Failure}");
Console.WriteLine($"Request ID: {e.RequestId}");
throw;
}CreateCustomer.cs
PHP
public static function runExample(GoogleAdsClient $googleAdsClient, int $managerCustomerId)
$customer = new Customer([
'descriptive_name' => 'Account created with CustomerService on ' . date('Ymd h:i:s'),
// For a list of valid currency codes and time zones see this documentation:
// https://developers.google.com/google-ads/api/reference/data/codes-formats.
'currency_code' => 'USD',
'time_zone' => 'America/New_York',
// The below values are optional. For more information about URL
// options see: https://support.google.com/google-ads/answer/6305348.
'tracking_url_template' => '{lpurl}?device={device}',
'final_url_suffix' => 'keyword={keyword}&matchtype={matchtype}&adgroupid={adgroupid}'
]);
// Issues a mutate request to create an account
$customerServiceClient = $googleAdsClient->getCustomerServiceClient();
$response = $customerServiceClient->createCustomerClient(
CreateCustomerClientRequest::build($managerCustomerId, $customer)
);
printf(
'Created a customer with resource name "%s" under the manager account with '
. 'customer ID %d.%s',
$response->getResourceName(),
$managerCustomerId,
PHP_EOL
);
}CreateCustomer.php
Python
def main(client, manager_customer_id):
customer_service = client.get_service("CustomerService")
customer = client.get_type("Customer")
now = 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-formats
customer.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/6305348
customer.tracking_url_template = "{lpurl}?device={device}"
customer.final_url_suffix = (
"keyword={keyword}&matchtype={matchtype}" "&adgroupid={adgroupid}"
response = 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}".'
)create_customer.py
Ruby
def create_customer(manager_customer_id)
# GoogleAdsClient will read a config file from
# ENV['HOME']/google_ads_config.rb when called without parameters
client = Google::Ads::GoogleAds::GoogleAdsClient.new
customer = client.resource.customer do |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-formats
c.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/6305348
c.tracking_url_template = "{lpurl}?device={device}"
c.final_url_suffix = "keyword={keyword}&matchtype={matchtype}&adgroupid={adgroupid}"
end
response = 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}."
endcreate_customer.rb
Perl
sub create_customer {
my ($api_client, $manager_customer_id) = @_;
# Initialize a customer to be created.
my $customer = Google::Ads::GoogleAds::V15::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-formats
currencyCode => "USD",
timeZone => "America/New_York",
# The below values are optional. For more information about URL options, see:
# https://support.google.com/google-ads/answer/6305348
trackingUrlTemplate => "{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;
return 1;
}create_customer.pl
上一页
arrow_back
概览
下一页
与经理帐号相关联
arrow_forward
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-01-12。
[]
[]
博客
欢迎访问我们的博客,了解重要公告。
论坛
与我们的开发者专家社区互动。
客户端库
使用官方支持的客户端库。
YouTube
访问我们的视频内容。
Android
Chrome
Firebase
Google Cloud Platform
所有产品
条款
隐私权政策
ICP证合字B2-20070004号
订阅 Google Developers 简报
订阅
English
Deutsch
Español
Español – América Latina
Français
Indonesia
Italiano
Polski
Português – Brasil
Tiếng Việt
Türkçe
Русский
עברית
العربيّة
فارسی
हिंदी
বাংলা
ภาษาไทย
中文 – 简体
中文 – 繁體
日本語
한국어