列出转化

致电Conversion.get() 返回已在 Search Ads 360 中处理的转化对象的列表。您 可以请求广告客户引擎账号中的所有转化,也可以将范围缩小到 特定广告系列、广告组、广告或关键字。

您在请求中指定的 Search Ads 360 ID 决定了 响应。例如:

  • 要查看某个引擎账号中的所有转化,请指定以下 ID: <ph type="x-smartling-placeholder">
      </ph>
    • agencyId
    • advertiserId
    • engineAccountId
  • 要查看特定广告系列中的转化次数,请指定以下 ID: <ph type="x-smartling-placeholder">
      </ph>
    • agencyId
    • advertiserId
    • engineAccountId
    • campaignId
  • 要查看归因于特定广告和关键字的转化,请指定 这些 ID: <ph type="x-smartling-placeholder">
      </ph>
    • agencyId
    • advertiserId
    • engineAccountId
    • campaignId
    • adGroupId(如果该关键字在广告组一级存在)
    • adId
    • criterionId

如需了解如何为广告客户获取 Search Ads 360 ID,请参阅 Search Ads 360 ID 和转化次数

在您发送请求后,Search Ads 360 会验证该请求,并生成 对象,并在ConversionList 响应正文。

Get 请求示例

以下示例请求获取自 11 月起发生的转化的列表 2012 年 12 月 31 日。

JSON

当您构建网址来获取转化列表时,请为前三项设置 参数(agencyId、 advertiserId 和 engineId)作为指向 转化资源。将其余参数指定为网址查询参数。

GET https://www.googleapis.com/doubleclicksearch/v2/agency/12300000000000456/advertiser/45600000000010291/engine/700000000042441/conversion?campaign=71700000001899732&startDate=20121115&endDate=20121231&startRow=0&rowCount=10
          

Java

  /**
   * Instantiate the Doubleclicksearch service, request a list of conversions in a specific campaign,
   * and print the list to standard out.
   */
  public static void main(String[] args) throws Exception {

    Doubleclicksearch service = getService(); // See Set Up Your Application.
    ConversionList conversionList = listConversions(service);
    outputList(conversionList);
  }


  /**
   * Request a list of the first 10 conversions in a specific campaign.
   */
  private static ConversionList listConversions(Doubleclicksearch service) throws IOException {
    try {
      Get getRequest = service.conversion().get(
          new Long(12300000000000456L), // Replace with your agency ID
          new Long(45600000000010291L), // Replace with your advertiser ID
          new Long(700000000042441L), // Replace with your engine account ID
          new Integer(20121231), // End date
          new Integer(10), // Number of rows
          new Integer(20121115), // Start date
          new Long(0L)); // Starting row
      getRequest.setCampaignId(71700000002044839L); // Optional parameter

      return getRequest.execute();
    } catch (GoogleJsonResponseException e) {
      System.err.println("Get request was rejected.");
      for (ErrorInfo error : e.getDetails().getErrors()) {
        System.err.println(error.getMessage());
      }
      System.exit(e.getStatusCode());
      return null; // Unreachable code.
    }
  }

 /**
  * Print to standard out.
  */
  privte static void outputList(ConversionList conversionList) {
    for (Conversion conversion : conversionList.getConversion()) {
      if (null != conversion) {
        System.out.println(conversion.toString());
      }
    }
  }
          

Python

def get_conversion(service):
  """Request the first 10 conversions in a specific campaign
     and print the list.

  Args:
    service: An authorized Doubleclicksearch service. See Set Up Your Application.
  """
  request = service.conversion().get(
      agencyId='12300000000000456', // Replace with your ID
      advertiserId='45600000000010291', // Replace with your ID
      engineAccountId='700000000042441', // Replace with your ID
      campaignId='71700000002044839', // Replace with your ID
      startDate=20131115,
      endDate=20131231,
      startRow=0,
      rowCount=10
  )

  pprint.pprint(request.execute())

Get 响应示例

如果请求验证成功,Search Ads 360 会返回ConversionList 响应正文。

{
 "kind": "doubleclicksearch#conversionList",
 "conversion": [
  {
   "agencyId": "12300000000000456",
   "advertiserId": "45600000000010291",
   "engineAccountId": "700000000042441",
   "campaignId": "71700000002044839",
   "adGroupId": "58700000032026064",
   "criterionId": "43700003491981017",
   "adId": "0",
   "dsConversionId": "48752623802180029",
   "conversionId": "ag5zfmV2ZW50YXBpZGVtb3ITCxILVHJhbnNhY3Rpb24YgfQDDA",
   "state": "ACTIVE",
   "type": "TRANSACTION",
   "revenueMicros": "20000000", // 20 million revenueMicros is equivalent to $20 of revenue
   "currencyCode": "USD",
   "quantityMillis": "0",
   "segmentationType": "FLOODLIGHT",
   "segmentationId": "25700000001081555",
   "segmentationName": "Customer Call",
   "conversionTimestamp": "1355776573000",
   "conversionModifiedTimestamp": "1355776580813"
  },
  {
   "agencyId": "12300000000000456",
   "advertiserId": "45600000000010291",
   "engineAccountId": "700000000042441",
   "campaignId": "71700000002044839",
   "adGroupId": "58700000032026064",
   "criterionId": "43700003491981017",
   "adId": "44700000155906860",
   "dsConversionId": "48752623802180029",
   "conversionId": "ag5zfmV2ZW50YXBpZGVtb3ITCxILVHJhbnNhY3Rpb24YgfQDDA",
   "state": "ACTIVE",
   "type": "TRANSACTION",
   "revenueMicros": "20000000",
   "currencyCode": "USD",
   "quantityMillis": "0",
   "segmentationType": "FLOODLIGHT",
   "segmentationId": "25700000001081555",
   "segmentationName": "Customer Call",
   "conversionTimestamp": "1355776573000",
   "conversionModifiedTimestamp": "1355776580813"
  },
  ...
 ]
}

如果验证失败

如果报告未通过验证,Search Ads 360 会返回“未找到”错误。 例如,如果上面的示例请求未指定实际 代理机构:

Not Found