เรียกใช้เมธอด Conversion.update()
เพื่อทําการเปลี่ยนแปลงประเภทต่อไปนี้กับ Conversion ที่มีอยู่อย่างน้อย 1 รายการ
- แก้ไขรายได้ รหัสสกุลเงิน หรือจำนวน
- แก้ไขรหัสคำสั่งซื้อที่ผู้ลงโฆษณาให้ไว้และตัวแปร Floodlight ที่กำหนดเอง
- นํา Conversion ออกโดยเปลี่ยน
conversion.state
จากACTIVE
เป็นREMOVED
Search Ads 360 ไม่รองรับการเปลี่ยนแปลงรายการต่อไปนี้
- วันที่ของ Conversion
- ประเภท Conversion
- คีย์เวิร์ด โฆษณา หรือการเข้าชมที่เป็นแหล่งที่มาของ Conversion
- ชื่อกิจกรรม Floodlight หรือชื่อกิจกรรม
อย่างไรก็ตาม คุณทำเครื่องหมาย Conversion ที่มีอยู่เป็น "นำออกแล้ว" และอัปโหลด Conversion ใหม่พร้อมวันที่ ประเภท รหัสการระบุแหล่งที่มา หรือกิจกรรม Floodlight ที่อัปเดตแล้วได้ทุกเมื่อ (อย่าลืมระบุ conversionId
ใหม่ด้วย)
เช่นเดียวกับ Conversion.insert()
หากคำขออัปเดตของคุณระบุ Conversion หลายรายการ Search Ads 360 จะพยายามอัปเดต Conversion แต่ละรายการอย่างเต็มความสามารถแทนการอัปเดตกลุ่มทั้งกลุ่มเป็นธุรกรรมเพียงเล็กน้อย หากการอัปเดตบางรายการในกลุ่มล้มเหลว การอัปเดตบางรายการอาจยังดำเนินการสำเร็จ เราขอแนะนำให้อ่านการตอบกลับสำหรับ Conversion ที่อัปเดตทุกรายการเพื่อให้การอัปเดตสำเร็จ
ส่งคำขออัปเดต
ช่องส่วนใหญ่ที่คุณระบุใน Conversion.update()
จะใช้เพื่อระบุ Conversion ที่คุณต้องการอัปเดต คุณจะใช้เทคนิคใดก็ได้ต่อไปนี้เพื่อระบุ Conversion ที่มีอยู่
- ระบุ
clickId
ของ Conversion- Conversion ทั้งหมดที่แก้ไขต้องอยู่ภายใน 60 วันนับจากวันที่สร้างรหัสคลิก
- ระบุ
criterionId
(รหัสคีย์เวิร์ด) ของ Conversion
ทั้ง 2 เทคนิคกำหนดให้คุณต้องระบุ conversionId
, conversionTimestamp
และธุรกรรม type
ของ Conversion
นอกจากนี้ หาก Conversion เดิมระบุ revenueMicros
และ currencyCode
หรือ quantityMillis
คำขออัปเดตจะต้องระบุข้อมูลนี้ แม้ว่าคุณจะไม่ได้เปลี่ยนแปลงข้อมูลก็ตาม
ระบุ Conversion ด้วยรหัสคลิก
หาก Conversion ระบุรหัสคลิกไว้ตั้งแต่ต้น คุณจะส่งคำขอ Conversion.update()
ที่ระบุช่องต่อไปนี้ได้
clickId
conversionId
conversionTimestamp
type
state
(จำเป็นต่อเมื่อคุณต้องการเปลี่ยนสถานะเป็น "นำออกแล้ว" หรือ "ใช้งานอยู่" เท่านั้น)quantityMillis
(เฉพาะในกรณีที่ระบุไว้ใน Conversion เดิม)revenueMicros
(เฉพาะในกรณีที่ระบุไว้ใน Conversion เดิม)currencyCode
(เฉพาะในกรณีที่ระบุไว้ใน Conversion เดิม)
ตัวอย่าง
ต่อไปนี้เป็นตัวอย่างของ Conversion 2 รายการที่มีอยู่
{ "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" }] }
คำขอต่อไปนี้อัปเดต Conversion รายการใดรายการหนึ่งจากตัวอย่างก่อนหน้าและนําอีกรายการออก
JSON
โปรดทราบว่าคำขอ Conversion.update()
ใช้เมธอด HTTP PUT
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())
ระบุ Conversion ตามรหัสคีย์เวิร์ด
หากคุณไม่มีสิทธิ์เข้าถึงรหัสคลิก หรือหาก Conversion มีการระบุแหล่งที่มาเป็นคีย์เวิร์ดหรือคีย์เวิร์ด/โฆษณาตั้งแต่แรก ให้ส่งคำขอ Conversion.update()
ที่ระบุช่องต่อไปนี้
criterionId
(รหัสคีย์เวิร์ด)conversionId
conversionTimestamp
type
state
(จำเป็นต่อเมื่อคุณต้องการเปลี่ยนสถานะเป็น "นำออกแล้ว" หรือ "ใช้งานอยู่" เท่านั้น)quantityMillis
(เฉพาะในกรณีที่ระบุไว้ใน Conversion เดิม)revenueMicros
(เฉพาะในกรณีที่ระบุไว้ใน Conversion เดิม)currencyCode
(เฉพาะในกรณีที่ระบุไว้ใน Conversion เดิม)
คุณเลือกระบุรหัสอื่นๆ เช่น รหัสโฆษณา รหัสแคมเปญ และอื่นๆ ของ Conversion ได้ แต่ไม่จําเป็นต้องระบุ Search Ads 360 ต้องใช้เฉพาะรหัสในรายการด้านบนเพื่อระบุ Conversion ที่มีอยู่
ตัวอย่าง
ต่อไปนี้คือตัวอย่างของ Conversion ที่มีอยู่
{ "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" }] }
คำขอต่อไปนี้จะอัปเดตการประทับเวลาของ Conversion
JSON
โปรดทราบว่าคำขอ Conversion.update()
ใช้เมธอด HTTP PUT
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
การตอบกลับสำหรับคำขออัปเดตจะเหมือนกับการตอบกลับสำหรับคำขอแทรก โดย Search Ads 360 จะแสดงความสำเร็จก็ต่อเมื่ออัปเดต Conversion ทั้งหมดในคำขอนั้นสำเร็จ
หากคำขอสำเร็จ การตอบกลับจะมีการแสดงภายในแบบเต็มของ Search Ads 360 สำหรับ Conversion ที่อัปเดตแต่ละรายการ เช่น รหัสแคมเปญ รหัสกลุ่มโฆษณา และรหัสคีย์เวิร์ด (เกณฑ์)
หากอัปเดตอย่างน้อย 1 รายการตรวจสอบหรืออัปโหลดไม่สำเร็จ การตอบกลับจะมีข้อความดำเนินการไม่สำเร็จสำหรับการอัปเดตที่ล้มเหลวแต่ละครั้ง การตอบกลับไม่มีข้อความเกี่ยวกับ Conversion ที่อัปเดตสำเร็จ ดูข้อมูลเพิ่มเติมเกี่ยวกับข้อความดำเนินการไม่สำเร็จได้ที่จัดการการตอบกลับของ Search Ads 360 สำหรับคำขอแทรก