ใช้โปรโมชันเพื่อแสดงข้อเสนอพิเศษสำหรับผลิตภัณฑ์ที่คุณขายบน Google โปรโมชันจะแสดงในผลิตภัณฑ์และบริการต่างๆ ของ Google ซึ่งรวมถึง Google Search, Shopping และ Chrome โปรโมชันต้องเป็นไปตามเกณฑ์บางอย่างจึงจะได้รับอนุมัติ ดูข้อมูลเพิ่มเติมได้ที่เกณฑ์ การโปรโมต
เมื่อคุณเพิ่มโปรโมชันไปยังผลิตภัณฑ์ ผู้เลือกซื้อจะเห็นลิงก์ข้อเสนอพิเศษ เช่น "ลด 15%" หรือ "จัดส่งฟรี" ลิงก์ข้อเสนอจะช่วยเพิ่มความน่าสนใจ ให้กับผลิตภัณฑ์และกระตุ้นให้ผู้เลือกซื้อทำการซื้อได้ โดยโปรโมชันทั้งหมดจะนำไปใช้ที่จุดชำระเงินหรือจุดขาย
ดูข้อมูลเพิ่มเติมได้ที่ข้อมูลเบื้องต้นเกี่ยวกับโปรโมชัน
ข้อกำหนดเบื้องต้น
Google จำเป็นต้องให้คุณป้อนข้อมูลที่เฉพาะเจาะจงเกี่ยวกับธุรกิจและผลิตภัณฑ์ก่อนที่ระบบจะแสดงโปรโมชันของคุณ คุณต้องมีสิ่งต่อไปนี้
- ฟีด ผลิตภัณฑ์ที่ใช้งานอยู่ใน Google Merchant Center
- ฟีด โปรโมชันที่ใช้งานอยู่ใน Google Merchant Center
- บัญชี Google Ads สําหรับแคมเปญ Shopping
นอกจากนี้ คุณต้องลงทะเบียนบัญชี Merchant Center ในโปรแกรมโปรโมชัน ด้วย หากไม่แน่ใจว่าได้ลงทะเบียนแล้วหรือยัง ให้ตรวจสอบใน Merchant Center
หากไม่ได้ลงทะเบียน โปรดกรอกแบบฟอร์มคำขอ ทีมโปรโมชันจะแจ้งให้ทราบเมื่อคุณพร้อมสำหรับการเริ่มใช้งาน
ดูข้อมูลเพิ่มเติมได้ที่เกณฑ์และนโยบายการเข้าร่วม
สร้างแหล่งข้อมูล
คุณสามารถใช้เมธอด
accounts.dataSources.create
เพื่อสร้างแหล่งข้อมูลโปรโมชัน หากมีแหล่งข้อมูลโปรโมชันที่มีอยู่ ให้ใช้วิธี
accounts.dataSources.list
เพื่อดึงแหล่งข้อมูลทั้งหมด จากนั้นคุณจะใช้ฟิลด์ name
ของแหล่งข้อมูลโปรโมชันเพื่อสร้างโปรโมชันได้
คำขอต่อไปนี้แสดงวิธีสร้างแหล่งข้อมูลเพื่อเพิ่มโปรโมชัน
POST https://merchantapi.googleapis.com/datasources/v1/accounts/{ACCOUNT_ID}/dataSources
{
"displayName": "{DISPLAY_NAME}",
"promotionDataSource": {
"contentLanguage": "{CONTENT_LANGUAGE}",
"targetCountry": "{TARGET_COUNTRY}"
}
}
แทนที่ค่าต่อไปนี้
- {ACCOUNT_ID}: ตัวระบุที่ไม่ซ้ำกันของบัญชี ตามที่ปรากฏใน UI ของ Merchant Center
- {DISPLAY_NAME}: ชื่อที่แสดงของแหล่งข้อมูล
- {CONTENT_LANGUAGE}: รหัสภาษา ISO 639-1 แบบ 2 ตัวอักษรของผลิตภัณฑ์ในแหล่งข้อมูล
- {TARGET_COUNTRY}: รหัสเขตแดน CLDR ของ ประเทศเป้าหมายที่คุณต้องการให้โปรโมชันแสดง
หลังจากคำขอทำงานสำเร็จแล้ว คุณจะเห็นการตอบกลับต่อไปนี้ซึ่ง มีรายละเอียดเกี่ยวกับแหล่งข้อมูลโปรโมชันที่สร้างขึ้นใหม่
{
"name": "accounts/{ACCOUNT_ID}/dataSources/{DATASOURCE_ID}",
"dataSourceId": "{DATASOURCE_ID}",
"displayName": "{DISPLAY_NAME}",
"promotionDataSource": {
"targetCountry": "{TARGET_COUNTRY}",
"contentLanguage": "{CONTENT_LANGUAGE}"
},
"input": "API"
}
สร้างโปรโมชัน
คุณสามารถใช้วิธี
accounts.promotions.insert
เพื่อสร้างหรืออัปเดตโปรโมชันได้ accounts.promotions.insert
เมธอด
รับ
promotions
ทรัพยากรและชื่อแหล่งข้อมูลเป็นอินพุต หากสำเร็จ ระบบจะแสดงโปรโมชันใหม่หรือที่อัปเดตแล้ว
การสร้างโปรโมชันต้องใช้ชื่อแหล่งข้อมูล นอกจากนี้ คุณต้องระบุค่าสำหรับช่องต่อไปนี้ในคำขอด้วย
contentLanguage
redemptionChannel
promotionId
targetCountry
attributes.offerType
attributes.genericRedemptionCode
attributes.couponValueType
attributes.productApplicability
attributes.promotionEffectiveTimePeriod.endTime
attributes.promotionEffectiveTimePeriod.startTime
attributes.longTitle
Google จะตรวจสอบและอนุมัติโปรโมชันของคุณก่อนเผยแพร่ ดูข้อมูลเพิ่มเติมได้ที่กระบวนการอนุมัติโปรโมชัน
เราขอแนะนำให้คุณอ่านนโยบาย โปรโมชันเพื่อให้แน่ใจว่า โปรโมชันที่คุณสร้างจะเพิ่มมูลค่าและเป็นไปตามนโยบายโฆษณา Shopping
คำขอต่อไปนี้แสดงวิธีสร้างโปรโมชันออนไลน์
HTTP
POST https://merchantapi.googleapis.com/promotions/v1/accounts/{ACCOUNT_ID}/promotions:insert
{
"promotion": {
"name": "{PROMOTION_NAME}",
"promotionId": "{PROMOTION_ID}",
"targetCountry": "{TARGET_COUNTRY}",
"redemptionChannel": [
"ONLINE"
],
"contentLanguage": "{CONTENT_LANGUAGE}",
"attributes": {
"promotionDisplayTimePeriod": {
"endTime": "{PROMOTION_END_TIME}",
"startTime": "{PROMOTION_START_TIME}"
},
"offerType": "{OFFER_TYPE}",
"longTitle": "{LONG_TITLE}"
}
},
"dataSource": "accounts/{ACCOUNT_ID}/dataSources/{DATASOURCE_ID}"
}
cURL
curl --request POST \
'https://merchantapi.googleapis.com/promotions/v1/accounts/{ACCOUNT_ID}/promotions:insert?key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"dataSource":"{DATASOURCE_ID}","promotion":{"name":"accounts/{ACCOUNT_ID}/promotions/{PROMOTION_ID}y","promotionId":"abc","contentLanguage":"en","targetCountry":"US","redemptionChannel":["ONLINE"]}}' \
--compressed
ดูข้อมูลเกี่ยวกับกฎที่ใช้กับการตั้งค่ารหัสโปรโมชันได้ที่ข้อกำหนดขั้นต่ำสำหรับแอตทริบิวต์รหัสโปรโมชัน
ค่าที่ใช้ได้สำหรับฟิลด์ offerType
ที่ต้องระบุคือ NO_CODE
และ GENERIC_CODE
หากไม่ระบุค่าใดค่าหนึ่งเหล่านี้ คำขอ API จะล้มเหลว
พร้อมการตอบกลับ HTTP 400 [offer_type] validation/missing_required: Invalid or
missing required attribute: offer_type
ระบบจะแสดงข้อความแสดงข้อผิดพลาดที่คล้ายกันหาก
คุณไม่ได้ระบุฟิลด์ที่จำเป็น
หากไม่ระบุค่าสำหรับฟิลด์ attributes.genericRedemptionCode
คำขอจะล้มเหลวพร้อมการตอบกลับ HTTP 400 [genericRedemptionCode] No
redemption code provided
ค่าสำหรับฟิลด์ promotion.attributes.promotionDisplayTimePeriod.startTime
และ promotion.attributes.promotionDisplayTimePeriod.endTime
ต้องอยู่ใน
รูปแบบ yyyy-mm-ddThh:mm:ssZ
โปรดตรวจสอบว่าได้แทนที่ค่าของฟิลด์เหล่านี้ด้วยวันที่ในอนาคตแล้ว
ดูข้อมูลเพิ่มเติมได้ที่ข้อกำหนดในการจัดทำข้อมูลโปรโมชัน
ดูแนวทางปฏิบัติแนะนำเกี่ยวกับการสร้างโปรโมชันได้ที่แนวทางปฏิบัติแนะนำสำหรับโปรโมชัน
ดูรายการแอตทริบิวต์ที่เกี่ยวข้องกับโปรโมชันได้ที่เพิ่มแอตทริบิวต์ Structured Data
หลังจากคำขอสร้างโปรโมชันทำงานสำเร็จแล้ว ระบบอาจใช้เวลา 2-3 นาที ในการดึงข้อมูลโปรโมชันโดยใช้ API หรือแสดงใน Merchant Center
ต่อไปนี้คือตัวอย่างที่คุณใช้เพื่อแทรกโปรโมชันหลายรายการแบบไม่พร้อมกันได้
Java
import com.google.api.core.ApiFuture;
import com.google.api.core.ApiFutureCallback;
import com.google.api.core.ApiFutures;
import com.google.api.gax.core.FixedCredentialsProvider;
import com.google.auth.oauth2.GoogleCredentials;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.protobuf.Timestamp;
import com.google.shopping.merchant.promotions.v1.Attributes;
import com.google.shopping.merchant.promotions.v1.CouponValueType;
import com.google.shopping.merchant.promotions.v1.InsertPromotionRequest;
import com.google.shopping.merchant.promotions.v1.OfferType;
import com.google.shopping.merchant.promotions.v1.ProductApplicability;
import com.google.shopping.merchant.promotions.v1.Promotion;
import com.google.shopping.merchant.promotions.v1.PromotionsServiceClient;
import com.google.shopping.merchant.promotions.v1.PromotionsServiceSettings;
import com.google.shopping.merchant.promotions.v1.RedemptionChannel;
import com.google.shopping.type.CustomAttribute;
import com.google.shopping.type.Destination.DestinationEnum;
import com.google.type.Interval;
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.stream.Collectors;
import shopping.merchant.samples.utils.Authenticator;
import shopping.merchant.samples.utils.Config;
/** This class demonstrates how to insert multiple promotions asynchronously. */
public class InsertPromotionsAsyncSample {
private static String generateRandomString() {
String characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
Random random = new Random();
StringBuilder sb = new StringBuilder(8);
for (int i = 0; i < 8; i++) {
sb.append(characters.charAt(random.nextInt(characters.length())));
}
return sb.toString();
}
private static Promotion createPromotion(String accountId) {
String merchantPromotionId = generateRandomString();
Attributes attributes =
Attributes.newBuilder()
.setProductApplicability(ProductApplicability.ALL_PRODUCTS)
.setOfferType(OfferType.GENERIC_CODE)
.setGenericRedemptionCode("ABCD1234")
.setLongTitle("My promotion")
.setCouponValueType(CouponValueType.PERCENT_OFF)
.addPromotionDestinations(DestinationEnum.SHOPPING_ADS)
.setPercentOff(10)
// Note that promotions have a 6-month limit.
// For more information, read here: https://support.google.com/merchants/answer/2906014
// Also note that only promotions valid within the past 365 days are shown in the UI.
.setPromotionEffectiveTimePeriod(
Interval.newBuilder()
.setStartTime(Timestamp.newBuilder().setSeconds(1726842472))
.setEndTime(Timestamp.newBuilder().setSeconds(1726842473))
.build())
.build();
return Promotion.newBuilder()
.setName(String.format("accounts/%s/merchantPromotions/%s", accountId, merchantPromotionId))
.setPromotionId(merchantPromotionId)
.setContentLanguage("fr")
.setTargetCountry("CH")
.addRedemptionChannel(RedemptionChannel.ONLINE)
.setAttributes(attributes)
// Custom attributes allow you to add additional information which is not available in
// Attributes. For example, you might want to pilot experimental functionality.
.addCustomAttributes(
CustomAttribute.newBuilder()
.setName("another example name")
.setValue("another example value")
.build())
.build();
}
public static void asyncInsertPromotions(String accountId, String dataSourceId) throws Exception {
GoogleCredentials credential = new Authenticator().authenticate();
PromotionsServiceSettings merchantPromotionsServiceSettings =
PromotionsServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(credential))
.build();
try (PromotionsServiceClient merchantPromotionsServiceClient =
PromotionsServiceClient.create(merchantPromotionsServiceSettings)) {
// Arbitrarily creates five merchant promotions with random IDs.
List<InsertPromotionRequest> requests = new ArrayList<>();
for (int i = 0; i < 5; i++) {
InsertPromotionRequest request =
InsertPromotionRequest.newBuilder()
.setParent(String.format("accounts/%s", accountId))
.setPromotion(createPromotion(accountId))
.setDataSource(String.format("accounts/%s/dataSources/%s", accountId, dataSourceId))
.build();
requests.add(request);
}
// Inserts the merchant promotions.
List<ApiFuture<Promotion>> futures =
requests.stream()
.map(
request ->
merchantPromotionsServiceClient.insertPromotionCallable().futureCall(request))
.collect(Collectors.toList());
// Creates callback to handle the responses when all are ready.
ApiFuture<List<Promotion>> responses = ApiFutures.allAsList(futures);
ApiFutures.addCallback(
responses,
new ApiFutureCallback<List<Promotion>>() {
@Override
public void onSuccess(List<Promotion> results) {
System.out.println("Inserted merchant promotions below:");
System.out.println(results);
}
@Override
public void onFailure(Throwable throwable) {
System.out.println(throwable);
}
},
MoreExecutors.directExecutor());
} catch (Exception e) {
System.out.println(e);
}
}
public static void main(String[] args) throws Exception {
Config config = Config.load();
asyncInsertPromotions(config.getAccountId().toString(), "<YOUR_DATA_SOURCE_ID>");
}
}
ต่อไปนี้คือตัวอย่างโปรโมชันที่คุณใช้เพื่อเริ่มต้นใช้งานได้
โปรโมชันในร้านที่ใช้ได้กับผลิตภัณฑ์และร้านค้าทั้งหมด
คำขอตัวอย่างต่อไปนี้แสดงวิธีสร้างโปรโมชันในร้านที่ ใช้ได้กับผลิตภัณฑ์ทั้งหมดในบัญชี Merchant Center และร้านค้าทั้งหมดที่เพิ่มในบัญชี Business Profile ที่ลิงก์ไว้
POST https://merchantapi.googleapis.com/promotions/v1/accounts/{ACCOUNT_ID}/promotions:insert
{
"promotion": {
"promotionId": "buy_2_get_10_off",
"contentLanguage": "en",
"targetCountry": "US",
"redemptionChannel": [
"IN_STORE"
],
"attributes": {
"longTitle": "Buy 2 and get 10$ OFF purchase",
"productApplicability": "ALL_PRODUCTS",
"offerType": "NO_CODE",
"couponValueType": "BUY_M_GET_MONEY_OFF",
"promotionDisplayTimePeriod": {
"startTime": "2024-2-06T00:47:44Z",
"endTime": "2024-5-06T00:47:44Z"
},
"promotionEffectiveTimePeriod": {
"startTime": "2024-2-06T00:47:44Z",
"endTime": "2024-5-06T00:47:44Z"
},
"moneyOffAmount": {
"amountMicros": "1000000",
"currencyCode": "USD"
},
"minimumPurchaseQuantity": 2,
"storeApplicability": "ALL_STORES",
"promotionUrl": "http://promotionnew4url.com/",
"promotionDestinations": [
"LOCAL_INVENTORY_ADS"
],
}
},
"dataSource": "accounts/{ACCOUNT_ID}/dataSources/{DATASOURCE_ID}"
}
ต้องระบุข้อมูลในช่อง productApplicability
โดยจะส่งสัญญาณความเกี่ยวข้องของ
โปรโมชันกับผลิตภัณฑ์ทั้งหมดหรือเฉพาะบางรายการ ค่าที่รองรับคือ ALL_PRODUCTS
และ SPECIFIC_PRODUCTS
ดูข้อมูลเพิ่มเติมได้ที่เลือก
ผลิตภัณฑ์สำหรับโปรโมชัน
ต้องระบุข้อมูลในช่อง couponValueType
ซึ่งจะส่งสัญญาณประเภทโปรโมชันที่คุณกำลังใช้งาน
ดูรายการค่าที่รองรับได้ที่ประเภทมูลค่าของคูปอง แอตทริบิวต์บางรายการ
ต้องระบุ ทั้งนี้ขึ้นอยู่กับประเภทมูลค่าของคูปองที่คุณเลือก
ฟิลด์ minimumPurchaseQuantity
ช่วยให้คุณกำหนดค่าสำหรับจำนวนการซื้อขั้นต่ำที่จำเป็นต่อการแลกสิทธิ์รับข้อเสนอโปรโมชัน ดูข้อมูลเพิ่มเติมได้ที่จำนวนการซื้อขั้นต่ำสำหรับโปรโมชัน
ในทำนองเดียวกัน คุณสามารถใช้ช่อง minimumPurchaseAmount
เพื่อกำหนดจำนวนเงินขั้นต่ำ
ในการซื้อที่จำเป็นต่อการแลกรับโปรโมชัน ดูข้อมูลเพิ่มเติมได้ที่จำนวนเงินขั้นต่ำในการซื้อ
ดูข้อมูลเพิ่มเติมเกี่ยวกับค่าที่คุณต้องระบุเพื่อสร้างโปรโมชันในร้านได้ที่ข้อกำหนดเกี่ยวกับแหล่งข้อมูลสำหรับโปรโมชันในร้าน
โปรโมชันออนไลน์ที่ใช้กับผลิตภัณฑ์ที่เลือกพร้อมรหัสแลกรับข้อเสนอ
คำขอตัวอย่างต่อไปนี้แสดงวิธีสร้างโปรโมชันออนไลน์ที่ ใช้กับผลิตภัณฑ์ที่เลือกโดยมีรหัสแลกรับข้อเสนอ
POST https://merchantapi.googleapis.com/promotions/v1/accounts/{ACCOUNT_ID}/promotions:insert
{
"promotion": {
"promotionId": "25_pct_off",
"contentLanguage": "en",
"targetCountry": "US",
"redemptionChannel": [
"ONLINE"
],
"attributes": {
"longTitle": "10% off on selected items",
"productApplicability": "SPECIFIC_PRODUCTS",
"offerType": "GENERIC_CODE",
"genericRedemptionCode": "SPRINGSALE",
"couponValueType": "PERCENT_OFF",
"promotionDisplayTimePeriod": {
"startTime": "2024-2-06T00:47:44Z",
"endTime": "2024-5-06T00:47:44Z"
},
"promotionEffectiveTimePeriod": {
"startTime": "2024-2-06T00:47:44Z",
"endTime": "2024-5-06T00:47:44Z"
},
"percentOff": 25,
"promotionDestinations": [
"FREE_LISTINGS"
],
"itemIdInclusion": [
"1499860100",
"1499860101",
"1499860102",
"1499860103",
"1499860104"
],
}
},
"dataSource": "accounts/{ACCOUNT_ID}/dataSources/1000000573361824"
}
ดูโปรโมชัน
หากต้องการดูโปรโมชัน ให้ใช้
accounts.promotions.get
คำขอ GET
นี้เป็นแบบอ่านอย่างเดียว โดยต้องระบุmerchantId
และรหัสของ
โปรโมชัน เมธอด GET
จะแสดงผลทรัพยากรโปรโมชันที่เกี่ยวข้อง
เช่น
HTTP
GET https://merchantapi.googleapis.com/promotions/v1/accounts/{ACCOUNT_ID}/promotions/{PROMOTION_ID}
cURL
curl \
'https://merchantapi.googleapis.com/promotions/v1/accounts/{ACCOUNT_ID}/promotions/{PROMOTION_ID}?key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--compressed
แทนที่ค่าต่อไปนี้
- {ACCOUNT_ID}: ตัวระบุที่ไม่ซ้ำกันของบัญชี Merchant Center
- {PROMOTION_ID}: ตัวระบุที่ไม่ซ้ำกันของ โปรโมชันที่ต้องการดึงข้อมูล รูปแบบคือ {CHANNEL} ~{CONTENT_LANGUAGE}~ {TARGET_COUNTRY}~{PROMOTION_ID}
โปรดทราบว่าโปรโมชันที่สร้างขึ้นใหม่จะใช้เวลา 2-3 นาทีจึงจะเรียกข้อมูลได้ โดยใช้ API
ดูโปรโมชันในร้าน
คำขอตัวอย่างต่อไปนี้จะดึงโปรโมชันในร้านที่มีรหัสโปรโมชันเป็น
in_store~en~US~buy_2_get_10_off
GET https://merchantapi.googleapis.com/promotions/v1/accounts/{ACCOUNT_ID}/promotions/in_store~en~US~buy_2_get_10_off
หลังจากคำขอสำเร็จแล้ว คุณจะเห็นการตอบกลับต่อไปนี้
{
"name": "accounts/{ACCOUNT_ID}/promotions/in_store~en~US~buy_2_get_10_off",
"promotionId": "buy_2_get_10_off",
"contentLanguage": "en",
"targetCountry": "US",
"redemptionChannel": [
"IN_STORE"
],
"attributes": {
"longTitle": "Buy 2 and get 10$ OFF purchase",
"productApplicability": "ALL_PRODUCTS",
"offerType": "NO_CODE",
"couponValueType": "BUY_M_GET_MONEY_OFF",
"promotionDisplayTimePeriod": {
"startTime": "2024-2-06T00:47:44Z",
"endTime": "2024-5-06T00:47:44Z"
},
"promotionEffectiveTimePeriod": {
"startTime": "2024-2-06T00:47:44Z",
"endTime": "2024-5-06T00:47:44Z"
},
"moneyOffAmount": {
"amountMicros": "1000000",
"currencyCode": "USD"
},
"minimumPurchaseQuantity": 2,
"storeApplicability": "ALL_STORES",
"promotionUrl": "http://promotionnew4url.com/",
"promotionDestinations": [
"LOCAL_INVENTORY_ADS"
],
}
"dataSource": "accounts/{ACCOUNT_ID}/dataSources/1000000573361824"
}
ฟิลด์ moneyOffAmount
ในตัวอย่างนี้ระบุส่วนลดที่เสนอในโปรโมชัน
ดูข้อมูลเพิ่มเติมได้ที่จำนวนส่วนลดที่เป็นตัวเงินของโปรโมชัน
ฟิลด์ promotionUrl
ในตัวอย่างนี้มีลิงก์ไปยังเว็บไซต์ของร้านค้า
ซึ่งผู้เลือกซื้อสามารถดูข้อมูลเพิ่มเติมเกี่ยวกับโปรโมชันได้ โปรโมชันโฆษณาสินค้าคงคลังในร้านจะแสดงข้อผิดพลาดหากคุณไม่ใส่ช่อง promotionUrl
ดูโปรโมชันออนไลน์
คำขอตัวอย่างต่อไปนี้จะดึงโปรโมชันออนไลน์ที่มีรหัสโปรโมชันเป็น
online~en~US~25_pct_off
GET https://merchantapi.googleapis.com/promotions/v1/accounts/{ACCOUNT_ID}/promotions/online~en~US~25_pct_off
{
"name": "accounts/{ACCOUNT_ID}/promotions/online~en~US~25_pct_off",
"promotionId": "25_pct_off",
"contentLanguage": "en",
"targetCountry": "US",
"redemptionChannel": [
"ONLINE"
],
"attributes": {
"longTitle": "10% off on selected items",
"productApplicability": "SPECIFIC_PRODUCTS",
"offerType": "GENERIC_CODE",
"genericRedemptionCode": "WINTERGIFT",
"couponValueType": "PERCENT_OFF",
"promotionDisplayTimePeriod": {
"startTime": "2024-2-06T00:47:44Z",
"endTime": "2024-5-06T00:47:44Z"
},
"promotionEffectiveTimePeriod": {
"startTime": "2024-2-06T00:47:44Z",
"endTime": "2024-5-06T00:47:44Z"
},
"percentOff": 25,
"promotionDestinations": [
"FREE_LISTINGS"
],
"itemIdInclusion": [
"1499860100",
"1499860101",
"1499860102",
"1499860103",
"1499860104"
],
}
"dataSource": "accounts/{ACCOUNT_ID}/dataSources/{dataSource}"
}
ฟิลด์ itemIdInclusion
ที่ใช้ในตัวอย่างนี้จะระบุผลิตภัณฑ์ที่มีสิทธิ์รับโปรโมชัน
ดูข้อมูลเพิ่มเติมได้ที่รหัสผลิตภัณฑ์สำหรับโปรโมชัน
แสดงรายการโปรโมชัน
คุณสามารถใช้เมธอด
promotions.list
เพื่อดูโปรโมชันทั้งหมดที่สร้างขึ้น
ตัวอย่างคำขอมีดังนี้
HTTP
GET https://merchantapi.googleapis.com/promotions/v1/{ACCOUNT_ID}/promotions
cURL
curl \
'https://merchantapi.googleapis.com/promotions/v1/accounts/{ACCOUNT_ID}/promotions?key=[YOUR_API_KEY]' \
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
--header 'Accept: application/json' \
--compressed
การตอบกลับจะมีรายการโปรโมชันทั้งหมดในบัญชี สำหรับโปรโมชันแต่ละรายการ คุณจะดูรายละเอียดต่างๆ ได้ เช่น promotionId
, redemptionChannel
,
dataSource
, promotionStatus
และอื่นๆ
ดูสถานะของโปรโมชัน
หากต้องการดูสถานะของโปรโมชัน ให้ดูแอตทริบิวต์ promotionStatus
ที่เมธอด
promotions.get
หรือ
promotions.list
แสดงผล
promotionStatus
ฟิลด์อาจมีค่าดังต่อไปนี้
IN_REVIEW
: โปรโมชันยังอยู่ระหว่างการตรวจสอบREJECTED
: โปรโมชันไม่ได้รับอนุมัติLIVE
: โปรโมชันได้รับอนุมัติและใช้งานได้STOPPED
: บัญชีหยุดโปรโมชันEXPIRED
: โปรโมชันไม่มีการใช้งานแล้วPENDING
: โปรโมชันไม่ได้หยุดทำงานและรีวิวทั้งหมดได้รับอนุมัติแล้ว แต่ วันที่ใช้งานอยู่ในอนาคตSTATE_UNSPECIFIED
: สถานะโปรโมชันที่ไม่รู้จัก
หากต้องการทำความเข้าใจกระบวนการอนุมัติโปรโมชันที่คุณสร้างขึ้น โปรดดูกระบวนการอนุมัติโปรโมชัน
ตัวอย่างสถานะโปรโมชัน
ตัวอย่างต่อไปนี้แสดงความแตกต่างระหว่างคำขอที่สำเร็จและคำขอที่ไม่สำเร็จ
ไม่มีการแมปผลิตภัณฑ์
เนื้อหาการตอบกลับต่อไปนี้แสดงโปรโมชันออนไลน์ที่ไม่ได้รับอนุมัติเนื่องจากไม่มีการแมปผลิตภัณฑ์
"promotionStatus": {
"destinationStatuses": [
{
"reportingContext": "FREE_LISTINGS",
"status": "REJECTED"
}
],
"itemLevelIssues": [
{
"code": "promotion_sku_unmapped",
"severity": "DISAPPROVED",
"resolution": "merchant_action",
"reportingContext": "FREE_LISTINGS",
"description": "Unmapped",
"detail": "This promotion couldn't be tested during review because it doesn't apply to any products that are currently in your Products feed",
"documentation": "https://support.google.com/merchants/answer/2906014",
"applicableCountries": [
"US"
]
},
{
"code": "promotion_sku_additional_requirements",
"severity": "DISAPPROVED",
"resolution": "merchant_action",
"reportingContext": "FREE_LISTINGS",
"description": "Promotion conditions not allowed",
"detail": "This promotion has additional requirements that are not allowed such as requiring customers to verify additional details like phone number or ID before showing the promotion details",
"documentation": "https://support.google.com/merchants/answer/2906014",
"applicableCountries": [
"US"
]
}
]
}
หากต้องการแก้ปัญหาเกี่ยวกับโปรโมชันที่ไม่ได้รับอนุมัติและดูวิธีหลีกเลี่ยงการไม่อนุมัติในอนาคต โปรดดูแก้ปัญหาเกี่ยวกับโปรโมชันที่ไม่ได้รับอนุมัติ
หากโปรโมชันที่คุณสร้างไม่ได้รับอนุมัติ คุณจะได้รับอีเมลที่ระบุ เหตุผลของการปฏิเสธและวิธีการแก้ไขปัญหา
โปรโมชันอยู่ระหว่างการประเมิน
เนื้อหาการตอบกลับต่อไปนี้แสดงโปรโมชันที่ยังอยู่ระหว่างการประเมิน
"promotionStatus": {
"destinationStatuses": [
{
"reportingContext": "FREE_LISTINGS",
"status": "PENDING"
},
{
"destination": "SHOPPING_ADS",
"status": "PENDING"
}
],
"itemLevelIssues": []
}
โปรโมชันที่ได้รับอนุมัติและใช้งานอยู่
เนื้อหาการตอบกลับต่อไปนี้แสดงโปรโมชันที่ผู้เลือกซื้อมองเห็น
"promotionStatus": {
"destinationStatuses": [
{
"reportingContext": "FREE_LISTINGS",
"status": "LIVE"
},
{
"destination": "SHOPPING_ADS",
"status": "LIVE"
} ],
"itemLevelIssues": []
}
ดูข้อมูลเพิ่มเติมได้ที่คำถามที่พบบ่อยเกี่ยวกับสถานะโปรโมชัน
ลบโปรโมชัน
คุณลบโปรโมชันโดยใช้ API ไม่ได้ หากต้องการลบโปรโมชัน คุณจะต้องเข้าถึง UI ของ Merchant Center ดูข้อมูลเพิ่มเติมได้ที่แก้ไขโปรโมชันหรือเปลี่ยนสถานะโปรโมชัน
หากต้องการสิ้นสุดโปรโมชันที่มีอยู่ คุณสามารถใช้วิธี
accounts.promotions.insert
เพื่ออัปเดตฟิลด์ attributes.promotionEffectiveTimePeriod.endTime
เป็น
เวลาในอดีต
ดูข้อมูลเพิ่มเติม
- ดูรายละเอียดเพิ่มเติมได้ที่ศูนย์ช่วยเหลือเกี่ยวกับโปรโมชัน
- โปรดดูวิธีแก้ปัญหาที่พบบ่อยในหัวข้อแก้ปัญหาเกี่ยวกับ Promotion Sub-API
- ดูข้อมูลเกี่ยวกับการย้ายข้อมูลจาก Content API for Shopping ได้ที่ย้ายข้อมูล การจัดการโปรโมชัน