การกำหนดเป้าหมาย

การจัดการการกําหนดเป้าหมายทรัพยากรเป็นฟีเจอร์หลักของ Display & Video 360 API การกำหนดเป้าหมายสามารถกำหนดให้กับทรัพยากรหลายประเภทและใช้ทรัพยากรและพื้นที่การระบุตัวตนอื่นๆ อีกหลายรายการ หน้านี้จะแสดงรายละเอียดข้อจํากัดที่ควรทราบและแนวทางปฏิบัติแนะนําในการใช้งานบริการตัวเลือกการกำหนดเป้าหมายที่กําหนดของ Display & Video 360 API

ใช้การรับค่าการกำหนดเป้าหมาย

ทรัพยากรย่อยจะรับการกําหนดเป้าหมายที่กําหนดให้กับทรัพยากรบางรายการ ตัวเลือกการกําหนดเป้าหมายที่ทรัพยากรย่อยรับค่ามาจะดึงข้อมูลได้ แต่จะแก้ไขไม่ได้ที่ระดับทรัพยากรย่อย ซึ่งจะช่วยให้บังคับใช้การตั้งค่าความปลอดภัยของแบรนด์และการกำหนดเป้าหมายอื่นๆ กับพาร์ทเนอร์หรือผู้ลงโฆษณาทั้งหมดได้

เส้นทางการสืบทอดสามารถดูได้ในแผนภาพด้านล่าง

แผนภาพการสืบทอดการกำหนดเป้าหมาย

ดังที่ระบุไว้ในแผนภาพ ระดับการกําหนดเป้าหมายบางระดับรองรับประเภทการกําหนดเป้าหมายเพียงบางส่วนเท่านั้น ซึ่งหมายความว่าตัวเลือกการกําหนดเป้าหมายบางรายการไม่สามารถตั้งค่าที่ระดับที่สูงขึ้นและรับค่ามา แต่ต้องตั้งค่าที่ระดับที่ต่ำกว่า

การสืบทอดในแหล่งข้อมูลของ YouTube และพาร์ทเนอร์

การรับค่าการกำหนดเป้าหมายจะไม่แสดงในแหล่งข้อมูลของ YouTube และพาร์ทเนอร์ใน Display & Video 360 API การกำหนดเป้าหมายที่กลุ่มโฆษณารับค่ามาจะไม่สามารถดึงข้อมูลได้ในระดับ AdGroup และการกำหนดเป้าหมาย YouTube ที่กําหนดให้กับทรัพยากรหลักจะไม่รับค่ามาจากทรัพยากรย่อย

หากต้องการเรียกข้อมูลการตั้งค่าการกําหนดเป้าหมายตามฟังก์ชันทั้งหมดสําหรับกลุ่มโฆษณา คุณควรเรียกข้อมูลตัวเลือกการกําหนดเป้าหมายที่กําหนดไว้สําหรับกลุ่มโฆษณา รายการโฆษณาหลัก และผู้ลงโฆษณาหลัก

โปรดคํานึงถึงการกำหนดเป้าหมายที่กําหนดไว้เมื่อสร้างรายการโฆษณา

นอกเหนือจากตัวเลือกการกำหนดเป้าหมายที่รับค่ามา การกำหนดเป้าหมายส่วนใหญ่จะกำหนดได้หลังจากสร้างรายการโฆษณาแล้วเท่านั้น อย่างไรก็ตาม การกำหนดเป้าหมายบางประเภทจะมีชุดย่อยของค่าเริ่มต้นที่กำหนดให้กับรายการโฆษณาเมื่อสร้างรายการโฆษณา ประเภทการกำหนดเป้าหมายดังกล่าว ได้แก่

การพยายามสร้างตัวเลือกการกำหนดเป้าหมายที่มีอยู่หรือลบตัวเลือกการกำหนดเป้าหมายที่ไม่มีอยู่จะแสดงข้อผิดพลาด เราจึงขอแนะนำให้คุณทราบชุดเครื่องมือการกำหนดเป้าหมายทั้งหมดที่กำหนดให้กับรายการโฆษณาเมื่อสร้าง หากต้องการเรียกข้อมูลการกำหนดเป้าหมายที่กําหนดให้กับรายการโฆษณาในประเภทการกําหนดเป้าหมายต่างๆ ให้ใช้ advertisers.lineItems.bulkListAssignedTargetingOptions

นอกจากนี้ ระบบจะตั้งค่าบางอย่างโดยค่าเริ่มต้นเมื่อไม่ได้กําหนดตัวเลือกการกําหนดเป้าหมายประเภทนั้นให้กับทรัพยากร เช่น หากทรัพยากรไม่มีการกำหนดตัวเลือกการกำหนดเป้าหมาย แสดงว่าทรัพยากรดังกล่าวใช้สถานะ "ตัวแทนจำหน่ายและตัวแทนจำหน่ายโดยตรงที่ได้รับอนุญาต"TARGETING_TYPE_AUTHORIZED_SELLER_STATUS

อย่าคาดหวัง "การกำหนดเป้าหมายเริ่มต้น" อัตโนมัติ

ใน Display & Video 360 การกำหนดเป้าหมายที่ตั้งไว้ที่ระดับแคมเปญหรือใบสั่งซื้อการใส่โฆษณาจะไม่ส่งต่อไปยังรายการโฆษณาย่อยในทันที การกำหนดเป้าหมายนี้เรียกว่า "การกำหนดเป้าหมายเริ่มต้น" และใช้เป็นตัวยึดตําแหน่งการกําหนดเป้าหมายซึ่งนําไปใช้กับรายการโฆษณาที่สร้างขึ้นภายหลังใน UI

ใน Display & Video 360 API ระบบจะไม่ใช้การกำหนดเป้าหมายเริ่มต้นกับรายการโฆษณาที่สร้างขึ้นใหม่โดยอัตโนมัติ การสร้างรายการโฆษณาพื้นฐานจะไม่คัดลอกการกำหนดเป้าหมายระดับแคมเปญหรือใบสั่งซื้อการใส่โฆษณา ในกรณีนี้ คุณต้องกำหนดเป้าหมายให้กับรายการโฆษณาแยกกันผ่านตัวเลือกการกำหนดเป้าหมายที่กำหนดไว้ โดยใช้วิธีการสร้างหรือแก้ไขแบบเป็นกลุ่ม

แต่เมธอดพิเศษอาจเป็นข้อยกเว้น ตัวอย่างเช่น รายการโฆษณาที่สร้างผ่านadvertisers.lineItems.generateDefault จะคัดลอกการตั้งค่าจากใบสั่งซื้อการใส่โฆษณาหลัก รวมถึงการกำหนดเป้าหมายที่กำหนด ในทํานองเดียวกัน รายการโฆษณาที่สร้างผ่านการทําซ้ำจะได้รับการกำหนดเป้าหมายเดียวกันกับรายการโฆษณาต้นฉบับ

ไม่สามารถแก้ไขการกําหนดเป้าหมาย YouTube และพาร์ทเนอร์

คุณจะอัปเดตการกำหนดเป้าหมายสำหรับแคมเปญ YouTube และพาร์ทเนอร์โดยเฉพาะโดยใช้ Display & Video 360 API ไม่ได้

การกําหนดเป้าหมาย YouTube และพาร์ทเนอร์ประกอบด้วยการกําหนดเป้าหมายทั้งหมดที่กำหนดให้กับรายการโฆษณา YouTube และพาร์ทเนอร์และกลุ่มโฆษณาโดยตรง รวมถึงการกำหนดเป้าหมายประเภทต่อไปนี้

  • TARGETING_TYPE_SESSION_POSITION
  • TARGETING_TYPE_YOUTUBE_CHANNEL
  • TARGETING_TYPE_YOUTUBE_VIDEO

คุณสามารถอัปเดตการกําหนดเป้าหมายนี้ได้โดยใช้ UI ของ Display & Video 360 โดยตรง หรือจะอัปโหลดไฟล์ Structured Data ก็ได้

กําหนดการกําหนดกลุ่มเป้าหมายด้วยตัวเลือกเดียว

ตัวเลือกการกำหนดเป้าหมายสําหรับประเภทการกําหนดเป้าหมายส่วนใหญ่จะกําหนดแยกกัน การกําหนดกลุ่มเป้าหมายไม่ได้เป็นไปตามรูปแบบโมดูลนี้ แต่จะได้รับมอบหมายในออบเจ็กต์รายละเอียดการกําหนดกลุ่มเป้าหมายแบบกำหนดค่าได้รายการเดียว ซึ่งแสดงรหัสของกลุ่มเป้าหมายที่จะรวมและยกเว้นเมื่อแสดงโฆษณา assignedTargetingOptionId สำหรับตัวเลือกกลุ่มเป้าหมายนี้จะต้องเป็น "audienceGroup" เสมอเมื่อกําหนดแล้ว

การออกแบบนี้หมายความว่าการเปลี่ยนแปลงการกำหนดกลุ่มเป้าหมายจะต้องลบตัวเลือกการกำหนดกลุ่มเป้าหมายที่กำหนดให้กับกลุ่มเป้าหมายที่มีอยู่ก่อน จากนั้นสร้างตัวเลือกการกำหนดกลุ่มเป้าหมายใหม่ของกลุ่มเป้าหมายนั้นด้วยการเปลี่ยนแปลงที่ต้องการ ซึ่งทำได้ในคําขอเดียวโดยใช้ advertisers.lineItems.bulkEditAssignedTargetingOptions

ตัวอย่างวิธีอัปเดตการกำหนดกลุ่มเป้าหมายเพื่อกําหนดเป้าหมายกลุ่มเป้าหมาย Google เพิ่มเติมในเชิงบวกมีดังนี้

Java

long advertiserId = advertiser-id;
long lineItemId = line-item-id
List<Long> addedGoogleAudienceIds =
    Arrays.asList(google-audience-id-to-add,...);

// Build Google audience targeting settings objects to add to audience
// targeting.
ArrayList<GoogleAudienceTargetingSetting> newGoogleAudienceSettings =
    new ArrayList<GoogleAudienceTargetingSetting>();

// Convert list of Google Audience IDs into list of settings.
for (Long googleAudienceId : addedGoogleAudienceIds) {
  newGoogleAudienceSettings.add(new GoogleAudienceTargetingSetting()
      .setGoogleAudienceId(googleAudienceId));
}

// Create relevant bulk edit request objects.
BulkEditLineItemAssignedTargetingOptionsRequest requestContent =
    new BulkEditLineItemAssignedTargetingOptionsRequest();
AudienceGroupAssignedTargetingOptionDetails updatedAudienceGroupDetails;
ArrayList<DeleteAssignedTargetingOptionsRequest> audienceGroupDeleteRequests =
    new ArrayList<DeleteAssignedTargetingOptionsRequest>();

try {
  // Retrieve existing audience group targeting.
  AssignedTargetingOption existingAudienceGroupTargetingOption =
      service
          .advertisers()
          .lineItems()
          .targetingTypes()
          .assignedTargetingOptions()
          .get(
              advertiserId,
              lineItemId,
              "TARGETING_TYPE_AUDIENCE_GROUP",
              "audienceGroup"
          ).execute();

  // Extract existing audience group targeting details.
  updatedAudienceGroupDetails =
      existingAudienceGroupTargetingOption.getAudienceGroupDetails();

  // Build and add delete request for existing audience group targeting.
  ArrayList<String> deleteAudienceGroupAssignedTargetingIds =
      new ArrayList<String>();
  deleteAudienceGroupAssignedTargetingIds.add("audienceGroup");

  audienceGroupDeleteRequests
      .add(new DeleteAssignedTargetingOptionsRequest()
          .setTargetingType("TARGETING_TYPE_AUDIENCE_GROUP")
          .setAssignedTargetingOptionIds(
              deleteAudienceGroupAssignedTargetingIds
          )
      );
}
catch (GoogleJsonResponseException e) {
  updatedAudienceGroupDetails =
      new AudienceGroupAssignedTargetingOptionDetails();
}

// Set delete requests in edit request.
requestContent.setDeleteRequests(audienceGroupDeleteRequests);

// Construct new group of Google Audiences to include in targeting.
GoogleAudienceGroup updatedIncludedGoogleAudienceGroup =
    updatedAudienceGroupDetails.getIncludedGoogleAudienceGroup();
if (updatedIncludedGoogleAudienceGroup != null) {
  List<GoogleAudienceTargetingSetting> updatedGoogleAudienceSettings =
      updatedIncludedGoogleAudienceGroup.getSettings();
  updatedGoogleAudienceSettings.addAll(newGoogleAudienceSettings);
  updatedIncludedGoogleAudienceGroup
      .setSettings(updatedGoogleAudienceSettings);
} else {
  updatedIncludedGoogleAudienceGroup = new GoogleAudienceGroup();
  updatedIncludedGoogleAudienceGroup.setSettings(newGoogleAudienceSettings);
}

// Add new Google Audience group to audience group targeting details.
updatedAudienceGroupDetails
    .setIncludedGoogleAudienceGroup(updatedIncludedGoogleAudienceGroup);

// Create new targeting option to assign.
AssignedTargetingOption newAudienceGroupTargeting =
    new AssignedTargetingOption();
newAudienceGroupTargeting
    .setAudienceGroupDetails(updatedAudienceGroupDetails);

// Build audience group targeting create request and add to list of create
// requests.
ArrayList<AssignedTargetingOption> createAudienceGroupAssignedTargetingOptions =
    new ArrayList<AssignedTargetingOption>();
createAudienceGroupAssignedTargetingOptions.add(newAudienceGroupTargeting);
ArrayList<CreateAssignedTargetingOptionsRequest> targetingCreateRequests =
    new ArrayList<CreateAssignedTargetingOptionsRequest>();
targetingCreateRequests.add(new CreateAssignedTargetingOptionsRequest()
    .setTargetingType("TARGETING_TYPE_AUDIENCE_GROUP")
    .setAssignedTargetingOptions(
        createAudienceGroupAssignedTargetingOptions
    )
);

// Set create requests in edit request.
requestContent.setCreateRequests(targetingCreateRequests);

// Configure and execute the bulk list request.
BulkEditLineItemAssignedTargetingOptionsResponse response =
    service.advertisers().lineItems()
        .bulkEditLineItemAssignedTargetingOptions(
            advertiserId,
            lineItemId,
            requestContent).execute();

Python

advertiser_id = advertiser-id
line_item_id = line-item-id
added_google_audiences = [google-audience-id-to-add,...]

# Build Google audience targeting settings objects to create.
new_google_audience_targeting_settings = []
for google_audience_id in added_google_audiences:
 new_google_audience_targeting_settings.append(
     {'googleAudienceId': google_audience_id}
 )

# Retrieve any existing line item audience targeting.
retrieved_audience_targeting = service.advertisers().lineItems(
).targetingTypes().assignedTargetingOptions().get(
   advertiserId=advertiser_id,
   lineItemId=line_item_id,
   targetingType="TARGETING_TYPE_AUDIENCE_GROUP",
   assignedTargetingOptionId="audienceGroup"
).execute()

updated_audience_group_details = {}

# Copy over any existing audience targeting.
if 'audienceGroupDetails' in retrieved_audience_targeting:
 updated_audience_group_details = retrieved_audience_targeting[
     'audienceGroupDetails']

# Append the new Google audience IDs to any existing positive Google
# audience targeting.
if 'includedGoogleAudienceGroup' in updated_audience_group_details:
 updated_audience_group_details[
     'includedGoogleAudienceGroup']['settings'].extend(
         new_google_audience_targeting_settings)
else:
 updated_audience_group_details['includedGoogleAudienceGroup'] = {
     'settings': new_google_audience_targeting_settings
 }

# Build bulk edit request.
bulk_edit_request = {
   'deleteRequests': [
       {
         'targetingType': "TARGETING_TYPE_AUDIENCE_GROUP",
         'assignedTargetingOptionIds': [
           "audienceGroup"
         ]
       }
   ],
   'createRequests': [
       {
           'targetingType': "TARGETING_TYPE_AUDIENCE_GROUP",
           'assignedTargetingOptions': [
               {'audienceGroupDetails': updated_audience_group_details}
           ]
       }
   ]
}

# Update the audience targeting
updated_audience_targeting = service.advertisers().lineItems(
).bulkEditLineItemAssignedTargetingOptions(
   advertiserId=advertiser_id,
   lineItemId=line_item_id,
   body=bulk_edit_request
).execute()

PHP

$advertiserId = advertiser-id;
$lineItemId = line-item-id;
$addedGoogleAudienceIds = array(google-audience-id-to-add,...);

// Convert list of Google Audience IDs into list of Google audience
// settings.
$newGoogleAudienceSettings = array();
foreach ($addedGoogleAudienceIds as $googleAudienceId) {
    $newSetting =
        new Google_Service_DisplayVideo_GoogleAudienceTargetingSetting();
    $newSetting->setGoogleAudienceId($googleAudienceId);
    $newGoogleAudienceSettings[] = $newSetting;
}

// Create a bulk edit request.
$requestBody =
    new Google_Service_DisplayVideo_BulkEditLineItemAssignedTargetingOptionsRequest();

$audienceGroupDeleteRequests = array();

try {
    // Retrieve existing audience group targeting.
    $existingAudienceGroupTargetingOption = $this
        ->service
        ->advertisers_lineItems_targetingTypes_assignedTargetingOptions
        ->get(
            $advertiserId,
            $lineItemId,
            'TARGETING_TYPE_AUDIENCE_GROUP',
            'audienceGroup'
        );

    // Extract existing audience group targeting details.
    $updatedAudienceGroupDetails =
        $existingAudienceGroupTargetingOption
            ->getAudienceGroupDetails();

    // Build and add delete request for existing audience group
    // targeting.
    $deleteAudienceGroupAssignedTargetingIds = array();
    $deleteAudienceGroupAssignedTargetingIds[] = "audienceGroup";

    $audienceGroupDeleteRequest =
        new Google_Service_DisplayVideo_DeleteAssignedTargetingOptionsRequest();
    $audienceGroupDeleteRequest
        ->setTargetingType('TARGETING_TYPE_AUDIENCE_GROUP');
    $audienceGroupDeleteRequest
        ->setAssignedTargetingOptionIds(
            $deleteAudienceGroupAssignedTargetingIds
        );
    $audienceGroupDeleteRequests[] = $audienceGroupDeleteRequest;
} catch (\Exception $e) {
    $updatedAudienceGroupDetails =
        new Google_Service_DisplayVideo_AudienceGroupAssignedTargetingOptionDetails();
}

// Set delete requests in edit request.
$requestBody->setDeleteRequests($audienceGroupDeleteRequests);

// Construct new group of Google audiences to include in targeting.
$updatedIncludedGoogleAudienceGroup = $updatedAudienceGroupDetails
    ->getIncludedGoogleAudienceGroup();

if (!empty($updatedIncludedGoogleAudienceGroup)) {
    // Get existing settings.
    $updatedGoogleAudienceSettings =
    $updatedIncludedGoogleAudienceGroup->getSettings();

    // Add new Google audiences to existing list.
    $updatedGoogleAudienceSettings = array_merge(
        $updatedGoogleAudienceSettings,
        $newGoogleAudienceSettings
    );

    // Set updated Google audience list.
    $updatedIncludedGoogleAudienceGroup
        ->setSettings($updatedGoogleAudienceSettings);
} else {
    // Create new Google audience group.
    $updatedIncludedGoogleAudienceGroup =
        new Google_Service_DisplayVideo_GoogleAudienceGroup();

    // Set list of new Google audiences for targeting.
    $updatedIncludedGoogleAudienceGroup
        ->setSettings($newGoogleAudienceSettings);
}

// Add new Google Audience group to audience group targeting details.
$updatedAudienceGroupDetails
    ->setIncludedGoogleAudienceGroup(
        $updatedIncludedGoogleAudienceGroup
    );

// Create new targeting option to assign.
$newAudienceGroupTargeting =
    new Google_Service_DisplayVideo_AssignedTargetingOption();
$newAudienceGroupTargeting
    ->setAudienceGroupDetails($updatedAudienceGroupDetails);

// Build audience group targeting create request and add to list of
// create requests.
$createAudienceGroupAssignedTargetingOptions = array();
$createAudienceGroupAssignedTargetingOptions[] =
    $newAudienceGroupTargeting;
$createAudienceGroupTargetingRequest =
    new Google_Service_DisplayVideo_CreateAssignedTargetingOptionsRequest();
$createAudienceGroupTargetingRequest->setTargetingType(
    "TARGETING_TYPE_AUDIENCE_GROUP"
);
$createAudienceGroupTargetingRequest->setAssignedTargetingOptions(
    $createAudienceGroupAssignedTargetingOptions
);
$createRequests[] = $createAudienceGroupTargetingRequest;

// Set create requests in edit request.
$requestBody->setCreateRequests($createRequests);

// Call the API, editing the assigned targeting options for the
// identified line item.
$response = $this
    ->service
    ->advertisers_lineItems
    ->bulkEditLineItemAssignedTargetingOptions(
        $advertiserId,
        $lineItemId,
        $requestBody
    );

เตรียมพร้อมสำหรับการเลิกใช้งานตัวเลือกการกำหนดเป้าหมาย

ตัวเลือกการกําหนดเป้าหมายไม่ใช่ตัวเลือกแบบคงที่ และอาจมีการเลิกใช้งานตัวเลือกจํานวนเล็กน้อยเป็นครั้งคราว เมื่อเลิกใช้งานแล้ว ตัวเลือกการกำหนดเป้าหมายจะไม่ส่งผลต่อการแสดงโฆษณาของรายการโฆษณา หลังจากเลิกใช้งานแล้ว ระบบจะนำตัวเลือกเหล่านี้ออกจากรายการบรรทัดที่มีอยู่ และคำขอที่พยายามดึงข้อมูลหรือกำหนดตัวเลือกเหล่านี้จะทำให้เกิดข้อผิดพลาด

เราขอแนะนําให้คุณตรวจสอบรหัสตัวเลือกการกําหนดเป้าหมายที่จัดเก็บไว้เป็นประจําเพื่อหลีกเลี่ยงข้อผิดพลาดเหล่านี้ เราขอแนะนําให้คุณแคชรหัสที่ใช้เป็นประจำเพื่อประหยัดโควต้า อย่างไรก็ตาม การจัดเก็บรหัสหมายความว่าคุณอาจไม่ทราบว่ามีการเลิกใช้งานตัวเลือกการกําหนดเป้าหมาย คุณจึงควรใช้ targetingOptions.targetingTypes.get เป็นประจำเพื่อดึงรหัสตัวเลือกการกำหนดเป้าหมายที่เก็บไว้ทั้งหมดเพื่อยืนยันว่า Display & Video 360 ยังรองรับอยู่

ดูรายละเอียดเกี่ยวกับการเลิกใช้งานที่สำคัญที่ผ่านมาและที่กำลังจะเกิดขึ้นได้ที่หน้าการเลิกใช้งานที่ประกาศแล้ว

อย่าส่งคําขออัปเดตรายการโฆษณาเดียวกันพร้อมกัน

การพยายามอัปเดตการตั้งค่าหรือการกําหนดเป้าหมายสำหรับรายการโฆษณารายการเดียวโดยใช้คําขอหลายรายการพร้อมกันจะแสดงข้อผิดพลาด คำขอที่เกี่ยวข้องมีดังนี้

หากต้องการเพิ่มหรือนําตัวเลือกการกําหนดเป้าหมายที่กําหนดไว้หลายรายการของบรรทัดรายการเดียวออกพร้อมกัน คุณควรใช้คําขอ advertisers.lineItems.bulkEditAssignedTargetingOptions รายการเดียว หากต้องการอัปเดตการตั้งค่าและการกําหนดเป้าหมายของรายการโฆษณา ให้จัดคิวคําขอ patch หรือ bulkUpdate และคําขอการกําหนดเป้าหมายที่เกี่ยวข้องเพื่อให้แน่ใจว่าระบบจะไม่ส่งคําขอที่ 2 จนกว่าคําขอแรกจะแสดงคําตอบ