Créer un algorithme d'enchères personnalisées

Un algorithme d'enchères personnalisées est basé sur une logique d'enchères définie par l'utilisateur. L'attribuer à un élément de campagne via sa stratégie d'enchères. Lors de la définition d'enchères sur l'inventaire publicitaire, l'élément de campagne utilisera cette logique personnalisée.

Commencez par choisir un type d'algorithme et créez la ressource d'algorithme.

Choisir un type d'algorithme d'enchères personnalisées

Le type d'algorithme détermine la façon dont la logique d'enchères est définie dans l'algorithme.

Choisissez l'un des types suivants pouvant être créés à l'aide de l'API Display & Video 360 :

  • SCRIPT_BASED : logique définie par un script importé. Le script est un fichier texte qui utilise la syntaxe Python de base.
  • RULE_BASED : logique définie par un ensemble de règles importé. Le fichier de règles est un fichier JSON AlgorithmRules importé.

Créer une ressource CustomBiddingAlgorithm

Utilisez une requête create pour créer un algorithme d'enchères personnalisé.

Un annonceur ou un partenaire peut être la owner d'un algorithme. S'il appartient à un annonceur, il ne peut être utilisé que par les campagnes publicitaires de cet annonceur. S'il appartient à un partenaire, il ne peut être utilisé que par les annonceurs avec lesquels il est intentionnellement partagé.

Voici comment créer un algorithme d'enchères personnalisées :

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']);