自定义转化变量
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
借助自定义转化变量,您可以将其他信息(以代码的形式)与您使用 Google Ads API 导入的转化(例如点击转化或来电转化)相关联。有了这些信息,您就可以创建细分报告,其中包含更丰富的转化数据。
例如,在导入购买新蓝色帽子这一转化时,您还可以同时导入两个相关联的标记:color
和 status
,它们的值分别为 blue
和 new
。具体步骤如下所示:
根据需要创建任意数量的自定义转化变量。每个变量对应一个代码。因此,如果您需要两个代码(color
和 status
),则需要创建两个自定义变量。ConversionCustomVariable
的必填字段如下:
name
:标识变量。该名称必须是唯一的。
tag
:在我们的示例中,标记为 color
和 status
。当您的网站向 Google Ads 发送转化时,事件代码段中会使用代码。如果您使用 Google Ads API,则需要在导入转化时指定自定义变量的资源名称,如后续步骤中所述。
导入转化(例如 ClickConversion
)时,请将 custom_variables
设置为在上一步中创建的所有自定义变量的列表。您需要设置每个自定义变量的所有字段:
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-08-26。
[null,null,["最后更新时间 (UTC):2025-08-26。"],[[["\u003cp\u003eCustom conversion variables allow associating additional information, like tags, to conversions uploaded via the Google Ads API.\u003c/p\u003e\n"],["\u003cp\u003eTo use custom variables, first create them, defining a unique name and tag for each desired piece of information.\u003c/p\u003e\n"],["\u003cp\u003eWhen uploading a conversion, include the custom variables, specifying their resource name and the corresponding value for the tag.\u003c/p\u003e\n"],["\u003cp\u003eThis process lets you add details like 'color' or 'status' to conversions, enabling richer data analysis and reporting.\u003c/p\u003e\n"]]],[],null,["# Custom Conversion Variables\n\n[Custom conversion variables](//support.google.com/google-ads/answer/9964350)\nlet you associate additional information, in the form of tags, to a conversion\nthat you import using the Google Ads API, such as click or call conversions. With this\ninformation, you can create segmented reports that provide richer data about\nyour conversions.\n\nFor example, when importing a conversion for the purchase of a new blue hat,\nyou could also import two associated tags: `color` and `status` with the values\n`blue` and `new`, respectively. Here are the steps:\n\n1. Create as many custom conversion variables as you need. Each variable\n corresponds to one tag. Therefore, if you want two tags (`color` and\n `status`), you need to create two custom variables. The required fields for\n [`ConversionCustomVariable`](/google-ads/api/reference/rpc/v21/ConversionCustomVariable) are as\n follows:\n\n | **Note:** See [`ConversionCustomVariable`](/google-ads/api/reference/rpc/v21/ConversionCustomVariable) for limitations on its fields.\n - [`name`](/google-ads/api/reference/rpc/v21/ConversionCustomVariable#name): Identifies the variable. The name must be unique.\n - [`tag`](/google-ads/api/reference/rpc/v21/ConversionCustomVariable#tag): For our example, the tags are `color` and `status`. Tags are used in the [event\n snippet](//support.google.com/google-ads/answer/9962082#Add&zippy=%2Cconversion-tracking-using-tags-on-your-website) when a conversion is sent to Google Ads by your website. If you use the Google Ads API, you would need to specify the resource name of the custom variables when importing conversions, as detailed in the next step.\n2. When importing a conversion, such as\n [`ClickConversion`](/google-ads/api/reference/rpc/v21/ClickConversion), set\n [`custom_variables`](/google-ads/api/reference/rpc/v21/ClickConversion#custom_variables%5B%5D) to\n the list of all custom variables you created in the previous step. You need\n to set all the fields of each custom variable:\n\n - [`conversion_custom_variable`](/google-ads/api/reference/rpc/v21/CustomVariable#conversion_custom_variable): The resource name of the custom variable you created in the previous step.\n - [`value`](/google-ads/api/reference/rpc/v21/CustomVariable#conversion_custom_variable): The value for the tag you want to associate with the conversion. For our example: `blue` and `new`."]]