맞춤 입찰 알고리즘 만들기

맞춤 입찰 알고리즘은 사용자가 정의한 입찰 로직에서 빌드됩니다. 입찰 전략을 통해 광고 항목에 할당합니다. 광고 인벤토리에 입찰할 때 광고 항목은 해당 맞춤 로직을 사용합니다.

먼저 알고리즘 유형을 선택하고 알고리즘 리소스를 만듭니다.

맞춤 입찰 알고리즘 유형 선택

알고리즘 유형은 알고리즘에서 입찰 논리가 정의되는 방식을 결정합니다.

Display & Video 360 API를 통해 생성할 수 있는 다음 유형 중 하나를 선택합니다.

  • SCRIPT_BASED: 업로드된 스크립트에 의해 설정된 로직입니다. 스크립트는 기본 Python 문법을 사용하는 텍스트 파일입니다.
  • RULE_BASED: 업로드된 규칙 세트에 의해 설정된 로직입니다. 규칙 세트는 업로드된 AlgorithmRules JSON 파일입니다.

CustomBiddingAlgorithm 리소스 만들기

create 요청을 사용하여 맞춤 입찰 알고리즘을 만듭니다.

광고주 또는 파트너가 알고리즘의 owner일 수 있습니다. 광고주가 소유한 경우 해당 광고주의 광고 캠페인에서만 사용할 수 있습니다. 파트너가 소유한 경우 의도적으로 공유된 광고주만 사용할 수 있습니다.

맞춤 입찰 알고리즘을 만드는 방법은 다음과 같습니다.

자바

// Provide the ID of the advertiser that will own the algorithm.
long advertiserId = advertiser-id;

// Provide the display name of the algorithm.
String displayName = display-name;

// Provide the type of custom bidding algorithm.
String customBiddingAlgorithmType = custom-bidding-algorithm-type;

// Create the custom bidding algorithm structure.
CustomBiddingAlgorithm algorithm =
    new CustomBiddingAlgorithm()
        .setAdvertiserId(advertiserId)
        .setDisplayName(displayName)
        .setEntityStatus("ENTITY_STATUS_ACTIVE")
        .setCustomBiddingAlgorithmType(customBiddingAlgorithmType);

// Create the algorithm.
CustomBiddingAlgorithm response = service.customBiddingAlgorithms().create(algorithm).execute();

// Display the new custom bidding algorithm ID.
System.out.printf(
    "Custom Bidding Algorithm was created with the ID %s.",
    response.getCustomBiddingAlgorithmId());

Python

# Provide the ID of the advertiser that will own the algorithm.
advertiser_id = advertiser-id

# Provide the display name of the algorithm.
display_name = display-name

# Provide the type of custom bidding algorithm.
custom_bidding_algo_type = custom-bidding-algorithm-type

# Build CustomBiddingAlgorithm object.
custom_bidding_algorithm_obj = {
    "advertiserId": advertiser_id,
    "displayName": display_name,
    "entityStatus": "ENTITY_STATUS_ACTIVE",
    "customBiddingAlgorithmType": custom_bidding_algo_type,
}

# Build and execute request.
algorithm_response = (
    service.customBiddingAlgorithms()
    .create(body=custom_bidding_algorithm_obj)
    .execute()
)

# Print ID of new custom bidding algorithm.
print(
    "Custom bidding algorithm was created with ID "
    f'{algorithm_response["customBiddingAlgorithmId"]}.'
)

PHP

// Provide the ID of the advertiser that will own the algorithm.
$advertiserId = advertiser-id;

// Provide the display name of the algorithm.
$displayName = display-name;

// Provide the type of custom bidding algorithm.
$customBiddingAlgorithmType = custom-bidding-algorithm-type;

// Create the custom bidding algorithm structure.
$algorithm = new Google_Service_DisplayVideo_CustomBiddingAlgorithm();
$algorithm->setAdvertiserId($advertiserId);
$algorithm->setDisplayName($displayName);
$algorithm->setEntityStatus('ENTITY_STATUS_ACTIVE');
$algorithm->setCustomBiddingAlgorithmType($customBiddingAlgorithmType);

// Call the API, creating the advertiser.
try {
    $result = $this->service->customBiddingAlgorithms->create($algorithm);
} catch (\Exception $e) {
    $this->renderError($e);
    return;
}

// Print ID of new custom bidding algorithm.
printf('<p>Custom Bidding Algorithm was created with the ID %s.</p>', $result['customBiddingAlgorithmId']);