カスタム入札アルゴリズムは、ユーザーが定義した入札ロジックに基づいて構築されます。入札戦略を通じて広告申込情報に割り当てます。広告枠に入札する際に、広告申込情報でそのカスタム ロジックが使用されます。
まず、アルゴリズム タイプを選択して、アルゴリズム リソースを作成します。
カスタム入札アルゴリズムのタイプを選択する
アルゴリズムのタイプは、アルゴリズムで入札ロジックがどのように定義されるかを決定します。
ディスプレイ&ビデオ 360 API で作成できる次のいずれかのタイプを選択します。
SCRIPT_BASED: アップロードされたスクリプトによって設定されたロジック。スクリプトは、基本的な Python 構文を使用するテキスト ファイルです。RULE_BASED: アップロードされたルールセットによって設定されたロジック。ルールセットは、アップロードされたAlgorithmRulesJSON ファイルです。
CustomBiddingAlgorithm リソースを作成する
create リクエストを使用して、カスタム入札アルゴリズムを作成します。
広告主またはパートナーのいずれかが、アルゴリズムの owner になることができます。広告主が所有している場合は、その広告主の広告キャンペーンでのみ使用できます。パートナーが所有している場合は、意図的に共有されている広告主のみが使用できます。
カスタム入札アルゴリズムを作成する手順は次のとおりです。
Java
// 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']);