Mevcut Dönüşümleri Değiştir

Bir veya daha fazla mevcut dönüşümde aşağıdaki türden değişiklikleri yapmak için Conversion.update() yöntemini çağırın:

Search Ads 360, aşağıdakilerin değiştirilmesini desteklemez:

  • Dönüşüm tarihi.
  • Dönüşüm türü.
  • Dönüşümle ilişkilendirilen anahtar kelime, reklam veya ziyaret.
  • Floodlight etkinliği veya etkinlik adı.

Ancak, mevcut bir dönüşümü her zaman KALDIRILDI olarak işaretleyebilir ve güncellenmiş tarihe, türe, ilişkilendirme kimliklerine veya Floodlight etkinliğine sahip yeni bir dönüşüm yükleyebilirsiniz (yeni bir conversionId belirttiğinizden de emin olun).

Conversion.insert() öğesinde olduğu gibi, güncelleme isteğiniz birden fazla dönüşüm belirtiyorsa Search Ads 360, tüm grubu ya hep ya da hiç işlemi olarak güncellemek yerine, her dönüşümü en iyi çaba temelinde güncellemeye çalışır. Bir toplu işlemdeki bazı güncellemeler başarısız olursa diğerleri yine başarılı olabilir. Güncellemenin başarılı olduğundan emin olmak için güncellenen her dönüşümün yanıtını okumanızı öneririz.

Güncelleme isteği gönder

Conversion.update() içinde belirttiğiniz alanların çoğu, güncellemek istediğiniz dönüşümleri tanımlamak için kullanılır. Mevcut bir dönüşümü tanımlamak için aşağıdaki tekniklerden birini kullanabilirsiniz:

  • Dönüşümün clickId değerini belirtin
    • Düzenlenen tüm dönüşümler, tıklama kimliğinin oluşturulduğu tarihten itibaren 60 gün içinde olmalıdır.
  • Dönüşümün criterionId değerini (anahtar kelime kimliği) belirtin

Her iki teknik de dönüşümün conversionId, conversionTimestamp ve type işlemlerini belirtmenizi gerektirir.

Ayrıca, orijinal dönüşümde revenueMicros ve currencyCode veya quantityMillis belirtilmişse bu verileri değiştirmeseniz bile güncelleme isteğinin bu verileri belirtmesi gerekir.

Dönüşümü tıklama kimliğiyle tanımlayın

Bir dönüşüm başlangıçta bir tıklama kimliği belirttiyse aşağıdaki alanları belirten bir Conversion.update() isteği gönderebilirsiniz:

  • clickId
  • conversionId
  • conversionTimestamp
  • type
  • state (yalnızca durumu KALDIRILDI veya ETKİN olarak değiştirmek istiyorsanız gereklidir)
  • quantityMillis (yalnızca orijinal dönüşümde belirtilmişse)
  • revenueMicros (yalnızca orijinal dönüşümde belirtilmişse)
  • currencyCode (yalnızca orijinal dönüşümde belirtilmişse)

Örnek

Aşağıda, mevcut iki dönüşüme örnek verilmiştir:

{
 "kind": "doubleclicksearch#conversionList",
  "conversion" : [{
    "clickId" : "COiYmPDTv7kCFcP0KgodOzQAAA",
    "conversionId" : "test_20130906_10",
    "conversionTimestamp" : "1378710000000",
    "segmentationType" : "FLOODLIGHT",
    "segmentationName" : "Test",
    "type": "TRANSACTION",
    "revenueMicros": "100000000", // 100 million revenueMicros is equivalent to $100 of revenue
    "currencyCode": "USD"
  },
  {
   "clickId": "COiYmPDTv7kCFcP0KgodOzQAAA",
   "conversionId": "test_1383337059137",
   "conversionTimestamp": "1378710000000",
   "segmentationType" : "FLOODLIGHT",
   "segmentationName" : "Test",
   "type": "ACTION",
   "quantityMillis": "1000"
  }]
}     

Aşağıdaki istek, önceki örnekteki dönüşümlerden birini günceller ve diğerini kaldırır:

JSON

Conversion.update() isteğinin PUT HTTP yöntemini kullandığını unutmayın.

PUT https://www.googleapis.com/doubleclicksearch/v2/conversion
Authorization: Bearer your OAuth 2.0 access token
Content-type: application/json
{
 "kind": "doubleclicksearch#conversionList",
 "conversion": [
  {
   "clickId": "COiYmPDTv7kCFcP0KgodOzQAAA", // Replace with data from your site
   "conversionId": "test_20130906_10",
   "conversionTimestamp": "1378710000000",
   "type": "TRANSACTION",
   "revenueMicros": "90000000", // 90 million revenueMicros is equivalent to $90 of revenue
   "currencyCode": "USD"
  },
  {
   "clickId": "COiYmPDTv7kCFcP0KgodOzQAAA", // Replace with data from your site
   "conversionId": "test_1383337059137",
   "conversionTimestamp": "1378710000000",
   "type": "ACTION",
   "quantityMillis": "1000",
   "state": "REMOVED"
  }
 ]
}        

Java

/**
 * Instantiate the Doubleclicksearch service, create a conversion that updates an existing conversion,
 * and upload the conversions.
 */
public static void main(String[] args) throws Exception {

  Doubleclicksearch service = getService(); // See Set Up Your Application.

  // Set up a List to keep track of each conversion you create.
  List<Conversion> conversions = new Vector<Conversion>();

  // Create a conversion and add it to the conversion list.
  // Just to get a little fancy, the updateConversionFromVisit() method can be used for all
  // visit conversions, including conversions that don't specify quantity, revenue, or currency.
  // If quantityMillis wasn't specified in the original conversion, specify -1L for the
  // quantityMillis parameter. Likewise, if revenueMicros wasn't specified originally,
  // specify -1L for the revenueMicros parameter and an empty string for currency.
  conversionList = updateConversionFromVisit(
      conversionList,
      "COiYmPDTv7kCFcP0KgodOzQAAA", // clickId. Replace with data from your site
      "test_20130906_10",           // conversionId
      1378710000000L,               // timeStamp
      "TRANSACTION",                // type
      "",                           // state
      -1L,                          // quantityMillis
      90000000L,                    // revenueMicros. Equivalent to $90 of revenue
      "USD");                       // currencyCode

   // Here's a conversion that needs to be removed. Just set the state parameter to "REMOVED".
   conversionList = updateConversionFromVisit(
      conversionList,
      "COiYmPDTv7kCFcP0KgodOzQAAA", // clickId. Replace with data from your site
      "test_1383337059137",         // conversionId
      1378710000000L,               // timeStamp
      "ACTION",                     // type
      "REMOVED",                    // state
      1000L,                        // quantityMillis
      -1L,                          // revenueMicros
      "");                          // currencyCode

    // Upload the List and handle the response.
    uploadConversions(conversions, service); // See an example in Add New Conversions. 
  }

/**
 * Create a conversion and add it to a List<Conversion>.
 */
  private static List<Conversion> updateConversionFromVisit(List<Conversion> conversions,
      String clickId,
      String conversionId,
      Long timeStamp,
      String type,
      String state,
      Long quantity,
      Long revenue,
      String currency) {

    // Identifies the existing conversion.
    Conversion conversion = new Conversion()
        .setClickId(clickId)
        .setConversionId(conversionId)
        .setConversionTimestamp(BigInteger.valueOf(timeStamp))
        .setType(type);

    // Only add these fields if the value is not empty greater than -1.
    if(!state.isEmpty()) conversion.setState(state);
    if (quantity > -1L) {
      conversion.setQuantityMillis(quantity);
    }
    if (revenue > -1L) {
      conversion.setRevenueMicros(revenue);
      if (!currency.isEmpty()) {
        conversion.setCurrencyCode(currency);
      } else {
        System.err.println(String.format(
            "Can't add conversion %s. It specifies revenue but no currency.",
            conversion.getConversionId()));
        return conversions;
      }
    }

    conversions.add(conversion);
    return conversions;
  }         

Python

def update_conversion(service):
  """Change the revenue for one existing conversion and remove another.

  Args:
    service: An authorized Doubleclicksearch service. See Set Up Your Application.
  """
  request = service.conversion().update(
      body=
      {
          'conversion' : [{
              'clickId' : 'COiYmPDTv7kCFcP0KgodOzQAAA', // Replace with data from your site
              'conversionId' : 'test_20130906_13',
              'conversionTimestamp' : '1378710000000',
              'segmentationType' : 'FLOODLIGHT',
              'segmentationName' : 'Test',
              'type': 'TRANSACTION',
              'revenueMicros': '90000000', // 90 million revenueMicros is equivalent to $90 of revenue
              'currencyCode': 'USD'
            },
            {
             'clickId': 'COiYmPDTv7kCFcP0KgodOzQAAA', // Replace with data from your site
             'conversionId': 'test_1383337059137_01',
             'conversionTimestamp': '1378710000000',
             'segmentationType' : 'FLOODLIGHT',
             'segmentationName' : 'Test',
             'type': 'ACTION',
             'quantityMillis': '1000',
             'state': 'REMOVED'
            }]
      }
  )

  pprint.pprint(request.execute())

Dönüşümü anahtar kelime kimliğine göre belirle

Bir tıklama kimliğine erişiminiz yoksa veya dönüşüm orijinal olarak bir anahtar kelime veya anahtar kelime/reklam ile ilişkilendirilmişse aşağıdaki alanları belirten bir Conversion.update() isteği gönderebilirsiniz:

  • criterionId (anahtar kelime kimliği)
  • conversionId
  • conversionTimestamp
  • type
  • state (yalnızca durumu KALDIRILDI veya ETKİN olarak değiştirmek istiyorsanız gereklidir)
  • quantityMillis (yalnızca orijinal dönüşümde belirtilmişse)
  • revenueMicros (yalnızca orijinal dönüşümde belirtilmişse)
  • currencyCode (yalnızca orijinal dönüşümde belirtilmişse)

İsteğe bağlı olarak dönüşümün reklam kimliği, kampanya kimliği gibi başka kimlikler belirtebilirsiniz, ancak bunları zorunlu tutabilirsiniz. Search Ads 360, mevcut bir dönüşümü tanımlamak için yalnızca yukarıdaki listede bulunan kimliklere ihtiyaç duyar.

Örnek

Mevcut bir dönüşüm örneğini aşağıda bulabilirsiniz:

{
 "kind": "doubleclicksearch#conversionList",
  "conversion" : [{
   "agencyId": "12300000000000456",
   "advertiserId": "45600000000010291",
   "engineAccountId": "700000000042441",
   "campaignId": "71700000002044839",
   "adGroupId": "58700000032026064",
   "criterionId": "43700004289911004",
   "adId": "44700000155906860",
   "conversionId": "test_1383157519886",
   "conversionTimestamp": "1378710000000",
   "type": "ACTION",
   "quantityMillis": "1000",
   "segmentationType": "FLOODLIGHT",
   "segmentationName": "Test"
  }]
}     

Aşağıdaki istek, dönüşümün zaman damgasını günceller:

JSON

Conversion.update() isteğinin PUT HTTP yöntemini kullandığını unutmayın.

PUT https://www.googleapis.com/doubleclicksearch/v2/conversion
Authorization: Bearer your OAuth 2.0 access token
Content-type: application/json
{
 "kind": "doubleclicksearch#conversionList",
 "conversion": [
  {
   "criterionId": "43700004289911004", // Replace with your ID
   "conversionId": "test_1383157519886",
   "conversionTimestamp": "1378710000000",
   "type": "ACTION",
   "quantityMillis": "3000"
  }
 ]
}        

Java

    // Send conversion data to updateConversion, which creates a conversion and adds it
    // to the conversion list.
    conversionList =  updateConversionFromKeyword(conversionList,
        43700004289911004L,   // criterionId. Replace with your ID
        "test_1383157519886", // conversionId
        1378710000000L,       // timeStamp
        "ACTION",             // type
        "",                   // state
        3000L,                // quantityMillis
        -1L,                  // revenueMicros
        "");                  // currencyCode

  private static List<Conversion> updateConversionFromKeyword(List<Conversion> conversions,
       Long criterionId,
       String conversionId,
       Long timeStamp,
       String type,
       String state,
       Long quantity,
       Long revenue,
       String currency
    ) {

   Conversion conversion = new Conversion()
   .setCriterionId(criterionId)
   .setConversionId(conversionId)
   .setConversionTimestamp(BigInteger.valueOf(timeStamp))
   .setType(type);

   // Only add these fields if the value is not empty greater than -1.
   if(!state.isEmpty()) conversion.setState(state);
   if (quantity > -1L) {
     conversion.setQuantityMillis(quantity);
   }
   if (revenue > -1L) {
     conversion.setRevenueMicros(revenue);
     if (!currency.isEmpty()) {
       conversion.setCurrencyCode(currency);
     } else {
       System.err.println(String.format(
           "Can't add conversion %s. It specifies revenue but no currency.",
           conversion.getConversionId()));
       return conversions;
     }
   }

   conversions.add(conversion);
   return conversions;
   }                 

Python

def update_conversion(service):
  """Change the timestamp of a conversion. Use only the keyword id (criterionId)
  to identify the conversion.

  Args:
    service: An authorized Doubleclicksearch service. See Set Up Your Application.
  """
  request = service.conversion().update(
      body=
      {
          'conversion': [{
              'criterionId': '43700004289911004', // Replace with your ID
              'conversionId': 'test_1383157519886',
              'conversionTimestamp': '1378760000000',
              'type': 'ACTION',
              'quantityMillis': '1000'
            }]
      }
  )

  pprint.pprint(request.execute())

Search Ads 360 yanıtlarını işleme

Güncelleme isteğinin yanıtı, ekleme isteğinin yanıtıyla aynıdır: Search Ads 360, yalnızca istekteki tüm dönüşümlerin başarıyla güncellendiğini gösterir.

İstek başarılı olursa yanıt, güncellenen her dönüşüm için kampanya kimliği, reklam grubu kimliği ve anahtar kelime (ölçüt) kimliği gibi tam Search Ads 360 dahili temsilini içerir.

Bir veya daha fazla güncelleme doğrulanamaz veya yüklenemezse yanıtta, başarısız olan her güncelleme için hata mesajları yer alır. Yanıt, başarıyla güncellenen dönüşümlerle ilgili mesajları içermez. Bu hata mesajları hakkında daha fazla bilgi için ekleme istekleriyle ilgili Search Ads 360 yanıtlarını işleme bölümüne bakın.