কাস্টম বিডিং বাস্তবায়ন করুন

Display & Video 360 API আপনাকে কাস্টম বিডিং বাস্তবায়ন সম্পূর্ণরূপে পরিচালনা করতে দেয়। আপনি কাস্টম বিডিং অ্যালগরিদম তৈরি করতে পারেন, স্বতন্ত্র স্ক্রিপ্ট আপলোড এবং যাচাই করতে পারেন, এবং বিডিং কৌশল হিসাবে একটি সংস্থানে একটি নির্দিষ্ট অ্যালগরিদম বরাদ্দ করতে পারেন৷

Display & Video 360 API-এর সাহায্যে কাস্টম বিডিং অ্যালগরিদম কীভাবে তৈরি, আপডেট এবং বরাদ্দ করা যায় এই পৃষ্ঠাটি বর্ণনা করে। প্রতিটি বিভাগ একটি কোড নমুনা প্রদান করে।

একটি কাস্টম বিডিং অ্যালগরিদম তৈরি করুন৷

একটি CustomBiddingAlgorithm অবজেক্ট একটি পৃথক অ্যালগরিদম প্রতিনিধিত্ব করে যা আপনি একটি লাইন আইটেমকে তার বিড কৌশলে ব্যবহারের জন্য বরাদ্দ করতে পারেন। এই অবজেক্টে অ্যালগরিদমের বিশদ বিবরণ রয়েছে, যেমন customBiddingAlgorithmType এবং entityStatus , সেইসাথে প্রতিটি প্রাসঙ্গিক বিজ্ঞাপনদাতার জেনারেট করা মডেলের জন্য readinessState এবং suspensionState । অ্যালগরিদম ব্যবহারের জন্য আপনি চাইল্ড রিসোর্স হিসেবে CustomBiddingScript এবং CustomBiddingAlgorithmRules অবজেক্ট তৈরি করতে পারেন।

একটি স্ক্রিপ্ট-ভিত্তিক কাস্টম বিডিং অ্যালগরিদম কীভাবে তৈরি করবেন তার একটি উদাহরণ এখানে দেওয়া হল:

জাভা

// Create the custom bidding algorithm structure.
CustomBiddingAlgorithm customBiddingAlgorithm =
    new CustomBiddingAlgorithm()
        .setAdvertiserId(advertiser-id)
        .setDisplayName(display-name)
        .setEntityStatus("ENTITY_STATUS_ACTIVE")
        .setCustomBiddingAlgorithmType("SCRIPT_BASED");

// Configure the create request.
CustomBiddingAlgorithms.Create request =
    service.customBiddingAlgorithms().create(customBiddingAlgorithm);

// Create the custom bidding algorithm.
CustomBiddingAlgorithm response = request.execute();

// Display the new custom bidding algorithm name.
System.out.printf(
    "Custom bidding algorithm %s was created.%n",
    response.getName()
);

পাইথন

# Create a custom bidding algorithm object.
custom_bidding_algorithm_obj = {
    'advertiserId': advertiser-id,
    'displayName': display-name,
    'entityStatus': 'ENTITY_STATUS_ACTIVE',
    'customBiddingAlgorithmType': 'SCRIPT_BASED'
}

# Create the custom bidding algorithm.
response = service.customBiddingAlgorithms().create(
    body=custom_bidding_algorithm_obj
).execute()

# Display the new custom bidding algorithm.
print(f'The following Custom Bidding Algorithm was created: {response}')

পিএইচপি

// Create a custom bidding algorithm object.
$customBiddingAlgorithm =
    new Google_Service_DisplayVideo_CustomBiddingAlgorithm();
$customBiddingAlgorithm->setAdvertiserId(advertiser-id);
$customBiddingAlgorithm->setDisplayName(display-name);
$customBiddingAlgorithm->setEntityStatus('ENTITY_STATUS_ACTIVE');
$customBiddingAlgorithm->setCustomBiddingAlgorithmType('SCRIPT_BASED');

// Create the custom bidding algorithm.
$result =
    $this->service->customBiddingAlgorithms->create($customBiddingAlgorithm);

// Display the new custom bidding algorithm name.
printf('Custom Bidding Algorithm %s was created.\n', $result['name']);

অ্যালগরিদম অ্যাক্সেস পরিচালনা করুন

কাস্টম বিডিং অ্যালগরিদমগুলি একজন অংশীদার বা বিজ্ঞাপনদাতার মালিকানাধীন হতে পারে৷ অংশীদারের মালিকানাধীন অ্যালগরিদমগুলি সেই অংশীদার এবং sharedAdvertiserIds ফিল্ডে তালিকাভুক্ত যেকোনো শিশু বিজ্ঞাপনদাতাদের দ্বারা অ্যাক্সেস এবং সংশোধন করা যেতে পারে। একজন বিজ্ঞাপনদাতার মালিকানাধীন অ্যালগরিদমগুলি সেই বিজ্ঞাপনদাতা এবং তার মূল অংশীদার দ্বারা অ্যাক্সেস এবং সংশোধন করা যেতে পারে, কিন্তু অন্য বিজ্ঞাপনদাতাদের সাথে শেয়ার করা যাবে না।

আপনি যদি শুধুমাত্র একজন বিজ্ঞাপনদাতার জন্য অ্যালগরিদম ব্যবহার করেন, তাহলে বিজ্ঞাপনদাতাকে advertiserId ফিল্ডের মালিক হিসেবে নিয়োগ করুন। অন্যথায়, অংশীদার আইডি ক্ষেত্রের মালিক হিসাবে বিজ্ঞাপনদাতাদের মূল অংশীদারকে বরাদ্দ করুন এবং বিজ্ঞাপনদাতাদের partnerId sharedAdvertiserIds ফিল্ডের সাথে অ্যাক্সেস দিন।

অ্যালগরিদম যুক্তি আপলোড করুন

আপনার কাস্টম বিডিং অ্যালগরিদমের প্রকারের উপর নির্ভর করে, আপনাকে পরবর্তীতে একটি স্ক্রিপ্ট বা একটি নিয়ম অবজেক্ট তৈরি করতে হবে যেখানে আপনি অ্যালগরিদম ব্যবহারের জন্য যুক্তি প্রদান করতে পারেন৷

একটি স্ক্রিপ্ট আপলোড করুন

স্ক্রিপ্ট-ভিত্তিক কাস্টম বিডিং অ্যালগরিদমগুলি একটি ইম্প্রেশনের মূল্য মূল্যায়ন করার জন্য ব্যবহারকারী-প্রদত্ত স্ক্রিপ্টগুলি নিয়োগ করে৷ সরল স্ক্রিপ্টের নমুনা এবং উন্নত ক্ষেত্রগুলির একটি তালিকা Display & Video 360 সহায়তা কেন্দ্রের মাধ্যমে উপলব্ধ।

নিম্নলিখিত বিভাগগুলি আপনাকে শেখায় কিভাবে একটি কাস্টম বিডিং অ্যালগরিদমে একটি নতুন বা আপডেট করা স্ক্রিপ্ট যোগ করতে হয়৷

একটি স্ক্রিপ্ট সম্পদ অবস্থান পুনরুদ্ধার করুন

প্রথমে, customBiddingAlgorithms.uploadScript পদ্ধতিতে কাস্টম বিডিং অ্যালগরিদম রিসোর্সের অধীনে একটি উপলব্ধ সংস্থান অবস্থান পুনরুদ্ধার করুন। এই অনুরোধটি একটি রিসোর্স নামের সাথে একটি CustomBiddingScriptRef অবজেক্ট ফেরত দেয়। আপনি আপনার স্ক্রিপ্ট ফাইলটি রিসোর্সের নাম দ্বারা নির্দেশিত অবস্থানে আপলোড করতে পারেন। তারপর আপনার স্ক্রিপ্ট রিসোর্স তৈরি করতে কাস্টম বিডিং স্ক্রিপ্ট রেফারেন্স অবজেক্ট ব্যবহার করুন।

এখানে একটি উপলব্ধ সম্পদ অবস্থান পুনরুদ্ধার কিভাবে একটি উদাহরণ:

জাভা

// Retrieve a usable custom bidding script
// reference.
CustomBiddingScriptRef scriptRef =
    service
        .customBiddingAlgorithms()
        .uploadScript(custom-bidding-algorithm-id)
        .setAdvertiserId(advertiser-id)
        .execute();

// Display the custom bidding script reference resource path.
System.out.printf(
    "The script can be uploaded to the following resource path: %s%n",
    scriptRef.getResourceName()
);

পাইথন

# Retrieve a usable custom bidding script reference
# object.
custom_bidding_script_ref = service.customBiddingAlgorithms().uploadScript(
    customBiddingAlgorithmId=custom-bidding-algorithm-id,
    advertiserId=advertiser-id
).execute()

# Display the new custom bidding script reference object.
print('The following custom bidding script reference object was retrieved:'
      f'{custom_bidding_script_ref}')

পিএইচপি

// Set parent advertiser ID of custom bidding
// algorithm in optional parameters array for request.
$optParams = array('advertiserId' => advertiser-id);

// Retrieve a usable custom bidding script reference.
$scriptRefResponse = $this->service->customBiddingAlgorithms->uploadScript(
    custom-bidding-algorithm-id,
    $optParams
);

// Display the new custom bidding script reference object.
printf(
    'The script can be uploaded to the following resource path: %s\n',
    $scriptRefResponse->getResourceName()
);

একটি স্ক্রিপ্ট ফাইল আপলোড করুন

একটি উপলব্ধ সংস্থান অবস্থান পুনরুদ্ধার করার পরে, media.upload পদ্ধতিতে Display & Video 360 সিস্টেমে সেই অবস্থানে আপনার স্ক্রিপ্ট ফাইল আপলোড করুন। এই পদ্ধতিটি একটি সাধারণ আপলোড সমর্থন করে যার জন্য ক্যোয়ারী প্যারামিটার প্রয়োজন uploadType=media

একটি পুনরুদ্ধার করা কাস্টম বিডিং স্ক্রিপ্ট রেফারেন্স অবজেক্ট দেওয়া একটি স্ক্রিপ্ট ফাইল কিভাবে আপলোড করতে হয় তার একটি উদাহরণ এখানে দেওয়া হল:

জাভা

// Create media object.
GoogleBytestreamMedia media = new GoogleBytestreamMedia();
media.setResourceName(resource-name);

// Create input stream for the script file.
InputStreamContent scriptFileStream =
    new InputStreamContent(
        null, new FileInputStream(script-path));

// Create media.upload request.
Media.Upload uploadRequest =
        service
            .media()
            .upload(
                resource-name,
                media,
                scriptFileStream);

// Retrieve uploader from the request and set it to us a simple
// upload request.
MediaHttpUploader uploader = uploadRequest.getMediaHttpUploader();
uploader.setDirectUploadEnabled(true);

// Execute the upload using an Upload URL with the destination resource
// name.
uploader
    .upload(
        new GenericUrl(
            "https://displayvideo.googleapis.com/upload/media/"
                + resource-name));

পাইথন

# Create a media upload object.
media = MediaFileUpload(script-path)

# Create upload request.
upload_request = service.media().upload(
    resourceName=resource-name, media_body=media)

# Override response handler to expect null response.
upload_request.postproc = HttpRequest.null_postproc

# Upload script to resource location given in retrieved custom bidding
# script reference object.
upload_request.execute()

পিএইচপি

// Create a media object.
$mediaBody = new Google_Service_DisplayVideo_GoogleBytestreamMedia();
$mediaBody->setResourceName(resource-name);

// Set parameters for upload request.
$optParams = array(
    'data' => file_get_contents(script-path),
    'uploadType' => 'media',
    'resourceName' => resource-name
);

// Upload script file to given resource location.
$this->service->media->upload(
    resource-name,
    $mediaBody,
    $optParams
);

cURL

curl --request POST 'https://displayvideo.googleapis.com/upload/media/resource-name?uploadType=media' 
  -H 'authorization: Bearer access-token'
  -H 'Content-Type: text/plain'
  --data-binary @script-path

একটি স্ক্রিপ্ট অবজেক্ট তৈরি করুন

একবার স্ক্রিপ্ট ফাইল আপলোড হয়ে গেলে, customBiddingAlgorithms.scripts.create পদ্ধতির সাথে একটি কাস্টম বিডিং স্ক্রিপ্ট রিসোর্স তৈরি করুন। অনুরোধে পাস করা CustomBiddingScript অবজেক্টে শুধুমাত্র CustomBiddingScriptRef অবজেক্টকে script ক্ষেত্রের নির্ধারিত মান হিসেবে অন্তর্ভুক্ত করা উচিত। এটি আপলোড করা স্ক্রিপ্ট ফাইলটিকে নতুন স্ক্রিপ্ট সম্পদের সাথে সংযুক্ত করে।

এখানে একটি স্ক্রিপ্ট সম্পদ কিভাবে তৈরি করতে হয় তার একটি উদাহরণ:

জাভা

// Create the custom bidding script structure.
CustomBiddingScript customBiddingScript =
    new CustomBiddingScript()
        .setScript(custom-bidding-script-ref);

// Create the custom bidding script.
CustomBiddingScript response =
    service
        .customBiddingAlgorithms()
        .scripts()
        .create(custom-bidding-algorithm-id, customBiddingScript)
        .setAdvertiserId(advertiser-id)
        .execute();

// Display the new script resource name
System.out.printf(
    "The following script was created: %s%n",
    response.getName());

পাইথন

# Create a custom bidding script object.
script_obj = {
    'script': custom-bidding-script-ref
}

# Create the custom bidding script.
response = service.customBiddingAlgorithms().scripts().create(
    customBiddingAlgorithmId=custom-bidding-algorithm-id,
    advertiserId=advertiser-id,
    body=script_obj).execute()

# Display the new custom bidding script object.
print(f'The following custom bidding script was created: {response}')

পিএইচপি

// Create the custom bidding script object.
$customBiddingScript =
    new Google_Service_DisplayVideo_CustomBiddingScript();
$customBiddingScript->setScript(custom-bidding-script-ref);

// Set parameters for create script request.
$optParams = array(
    'advertiserId' => advertiser-id
);

// Create the custom bidding script.
$result = $this->service->customBiddingAlgorithms_scripts->create(
    custom-bidding-algorithm-id,
    $customBiddingScript,
    $optParams
);

// Display the new script resource name.
printf('The following script was created: %s.\n', $result->getName());

একবার আপনি একটি কাস্টম বিডিং স্ক্রিপ্ট রিসোর্স তৈরি করলে, Display & Video 360 স্ক্রিপ্টটি প্রক্রিয়া করে তা নিশ্চিত করতে যে এটি ইম্প্রেশন স্কোর করতে সফলভাবে ব্যবহার করা যেতে পারে। স্ক্রিপ্ট অবজেক্টের state ফিল্ডের মাধ্যমে এই প্রক্রিয়াকরণের অবস্থা পুনরুদ্ধার করুন। নতুন স্ক্রিপ্ট গ্রহণ করা হলে, কাস্টম বিডিং অ্যালগরিদম ইম্প্রেশন মান স্কোর করতে স্ক্রিপ্ট ব্যবহার করা শুরু করে। এটি অবিলম্বে ঘটে, তাই নিশ্চিত হন যে আপনি একটি নতুন স্ক্রিপ্ট সংস্থান তৈরি করার আগে অ্যালগরিদম আপডেট করতে চান৷

আপলোডের নিয়ম

নিয়ম-ভিত্তিক কাস্টম বিডিং অ্যালগরিদম একটি ইম্প্রেশনের মূল্য মূল্যায়ন করার জন্য একটি AlgorithmRules অবজেক্টে প্রদত্ত যুক্তি ব্যবহার করে।

AlgorithmRules অবজেক্টগুলি একটি JSON ফাইলে আপলোড করা হয় এবং তারপর একটি CustomBiddingAlgorithmRules অবজেক্টের মাধ্যমে একটি কাস্টম বিডিং অ্যালগরিদমের সাথে যুক্ত হয়।

একটি নিয়ম সম্পদ অবস্থান পুনরুদ্ধার করুন

প্রথমে, customBiddingAlgorithms.uploadRules পদ্ধতির সাহায্যে কাস্টম বিডিং অ্যালগরিদম রিসোর্সের অধীনে একটি উপলব্ধ সংস্থান অবস্থান পুনরুদ্ধার করুন। এই অনুরোধটি একটি রিসোর্স নামের সাথে একটি CustomBiddingAlgorithmsRulesRef অবজেক্ট প্রদান করে। আপনি সম্পদের নাম দ্বারা নির্দেশিত অবস্থানে আপনার নিয়ম ফাইল আপলোড করতে পারেন। তারপর আপনার নিয়ম সংস্থান তৈরি করতে কাস্টম বিডিং অ্যালগরিদম নিয়ম রেফারেন্স অবজেক্ট ব্যবহার করুন।

এখানে একটি উপলব্ধ সম্পদ অবস্থান পুনরুদ্ধার কিভাবে একটি উদাহরণ:

জাভা

// Create the custom bidding algorithm structure.
CustomBiddingAlgorithmRulesRef rulesRef =
    service
        .customBiddingAlgorithms()
        .uploadRules(custom-bidding-algorithm-id)
        .setAdvertiserId(advertiser-id)
        .execute();

System.out.printf(
    "The rules can be uploaded to the following resource path: %s%n",
    rulesRef.getResourceName()
);

পাইথন

# Retrieve a usable custom bidding algorithm rules reference
# object.
custom_bidding_algorithm_rules_ref = service.customBiddingAlgorithms().uploadRules(
    customBiddingAlgorithmId=custom-bidding-algorithm-id,
    advertiserId=advertiser-id
).execute()

# Display the new custom bidding algorithm rules reference object.
print('The following custom bidding algorithm rules reference object was retrieved:'
      f' {custom_bidding_algorithm_rules_ref}')

পিএইচপি

// Set parent advertiser ID of custom bidding algorithm
// in optional parameters array for request.
$optParams = array('advertiserId' => advertiser-id);

// Retrieve a usable custom bidding algorithm rules reference.
$rulesRefResponse = $this->service->customBiddingAlgorithms->uploadRules(
    custom-bidding-algorithm-id,
    $optParams
);

// Display the new custom bidding algorithm rules reference object resource path.
printf(
    'The rules can be uploaded to the following resource path: %s\n',
    $rulesRefResponse->getResourceName()
);

একটি AlgorithmRules ফাইল আপলোড করুন

একটি উপলব্ধ সংস্থান অবস্থান পুনরুদ্ধার করার পরে, media.upload পদ্ধতির মাধ্যমে Display & Video 360 সিস্টেমে সেই অবস্থানে আপনার নিয়ম ফাইল আপলোড করুন। এই পদ্ধতিটি একটি সাধারণ আপলোড সমর্থন করে যার জন্য ক্যোয়ারী প্যারামিটার প্রয়োজন uploadType=media

একটি পুনরুদ্ধার করা কাস্টম বিডিং অ্যালগরিদম নিয়ম রেফারেন্স অবজেক্ট দেওয়া একটি AlgorithmRules ফাইল আপলোড করার একটি উদাহরণ এখানে দেওয়া হল:

জাভা

// Create media object.
GoogleBytestreamMedia media = new GoogleBytestreamMedia();
media.setResourceName(resource-name);

// Create input stream for the rules file.
InputStreamContent rulesFileStream =
    new InputStreamContent(
        null, new FileInputStream(rules-file-path));

// Create media.upload request.
 Media.Upload uploadRequest =
    service
        .media()
        .upload(
            resource-name,
            media,
            rulesFileStream);

// Retrieve uploader from the request and set it to us a simple
// upload request.
MediaHttpUploader uploader = uploadRequest.getMediaHttpUploader();
uploader.setDirectUploadEnabled(true);

// Execute the upload using an Upload URL with the destination resource
// name.
uploader
    .upload(
        new GenericUrl(
            "https://displayvideo.googleapis.com/upload/media/"
                + resource-name));

পাইথন

# Create a media upload object.
media = MediaFileUpload(rules-file-path)

# Create upload request.
upload_request = service.media().upload(
    resourceName=resource-name, media_body=media)

# Override response handler to expect null response.
upload_request.postproc = HttpRequest.null_postproc

# Upload rules file to resource location given in retrieved custom bidding
# algorithm rules reference object.
upload_request.execute()

পিএইচপি

// Create a media object.
$mediaBody = new Google_Service_DisplayVideo_GoogleBytestreamMedia();
$mediaBody->setResourceName(resource-name);

// Set parameters for upload request.
$optParams = array(
    'data' => file_get_contents(rules-file-path),
    'uploadType' => 'media',
    'resourceName' => resource-name
);

// Upload rules file to given resource location.
$this->service->media->upload(
    resource-name,
    $mediaBody,
    $optParams
);

cURL

curl --request POST 'https://displayvideo.googleapis.com/upload/media/resource-name?uploadType=media' 
  -H 'authorization: Bearer access-token'
  -H 'Content-Type: text/plain'
  --data-binary @rules-file-path

একটি নিয়ম অবজেক্ট তৈরি করুন

AlgorithmRules JSON ফাইল আপলোড হয়ে গেলে, customBiddingAlgorithms.rules.create পদ্ধতির সাথে একটি কাস্টম বিডিং অ্যালগরিদম নিয়ম সংস্থান তৈরি করুন। অনুরোধে পাস করা CustomBiddingAlgorithmRules অবজেক্টে শুধুমাত্র rules ক্ষেত্রের নির্ধারিত মান হিসেবে CustomBiddingAlgorithmRulesRef অবজেক্ট অন্তর্ভুক্ত করা উচিত। এটি আপলোড করা AlgorithmRules JSON ফাইলটিকে নতুন নিয়ম সংস্থানের সাথে সংযুক্ত করে।

এখানে একটি নিয়ম সংস্থান তৈরি করার একটি উদাহরণ রয়েছে:

জাভা

// Create the custom bidding algorithm rules structure.
CustomBiddingAlgorithmRules customBiddingAlgorithmRules =
    new CustomBiddingAlgorithmRules()
        .setRules(custom-bidding-algorithm-rules-ref);

// Create the rules resource.
CustomBiddingAlgorithmRules response =
    service
        .customBiddingAlgorithms()
        .rules()
        .create(custom-bidding-algorithm-id, customBiddingAlgorithmRules)
        .setAdvertiserId(advertiser-id)
        .execute();

// Display the new rules resource name.
System.out.printf(
    "The following custom bidding algorithm rules object was created: %s%n",
    response.getName());

পাইথন

# Create the custom bidding algorithm rules object.
rules_obj = {
    'rules': custom-bidding-algorithm-rules-ref
}

# Create the rules resource.
response = service.customBiddingAlgorithms().rules().create(
    customBiddingAlgorithmId=custom-bidding-algorithm-id,
    advertiserId=advertiser-id,
    body=rules_obj).execute()

# Display the new custom bidding algorithm rules object.
print(f'The following custom bidding algorithm rules resource was created: {response}')

পিএইচপি

// Create the custom bidding algorithm rules object.
$customBiddingAlgorithmRules =
    new Google_Service_DisplayVideo_CustomBiddingAlgorithmRules();
$customBiddingAlgorithmRules->setRules(custom-bidding-algorithm-rules-ref);

// Set parameters for create rules request.
$optParams = array(
    'advertiserId' => advertiser-id
);

// Create the custom bidding algorithm rules resource.
$result = $this->service->customBiddingAlgorithms_rules->create(
    custom-bidding-algorithm-id,
    $customBiddingAlgorithmRules,
    $optParams
);

// Display the new custom bidding algorithm rules resource name.
printf('The following rules resource was created: %s.\n', $result->getName());

একবার আপনি একটি নিয়ম সংস্থান তৈরি করলে, Display & Video 360 রুলসেট প্রক্রিয়া করে তা নিশ্চিত করে যে এটি ইম্প্রেশন স্কোর করতে সফলভাবে ব্যবহার করা যেতে পারে। নিয়ম অবজেক্টের state ফিল্ডের মাধ্যমে এই প্রক্রিয়াকরণের অবস্থা পুনরুদ্ধার করুন। নতুন নিয়ম গৃহীত হলে, কাস্টম বিডিং অ্যালগরিদম অবিলম্বে ইম্প্রেশন মান স্কোর করতে নিয়মগুলি ব্যবহার করা শুরু করে।

নিয়ম প্রত্যাখ্যান করা হলে, নিয়ম বস্তুর error থেকে প্রত্যাখ্যানের কারণ পুনরুদ্ধার করুন। প্রত্যাখ্যানের ক্ষেত্রে, ত্রুটিটি ঠিক করতে আপনার AlgorithmRules অবজেক্ট আপডেট করুন এবং নিয়ম রেফারেন্স অবজেক্ট পুনরুদ্ধার থেকে শুরু করে আপলোড প্রক্রিয়াটি পুনরাবৃত্তি করুন।

একটি কাস্টম বিডিং অ্যালগরিদম বরাদ্দ করুন৷

আপনি একটি কাস্টম বিডিং অ্যালগরিদম তৈরি করার পরে, স্বীকৃত যুক্তি আপলোড করার পরে এবং প্রয়োজনীয় প্রয়োজনীয়তাগুলি পূরণ করার পরে, আপনি একটি লাইন আইটেম বা সন্নিবেশ অর্ডারের বিডিং কৌশলে আপনার কাস্টম বিডিং অ্যালগরিদম বরাদ্দ করতে পারেন৷

আপনি যথাক্রমে performanceGoalType এবং customBiddingAlgorithmId ক্ষেত্রগুলিতে BIDDING_STRATEGY_PERFORMANCE_GOAL_TYPE_CUSTOM_ALGO এবং কাস্টম বিডিং অ্যালগরিদম আইডি বরাদ্দ করে ব্যয় এবং কর্মক্ষমতা লক্ষ্য বিড কৌশলগুলিকে সর্বাধিক করার জন্য কাস্টম বিডিং অ্যালগরিদম ব্যবহার করতে পারেন৷ বিড কৌশলের উপর নির্ভর করে, অন্যান্য বিড প্যারামিটার উপলব্ধ বা প্রয়োজন হতে পারে।

প্রদত্ত কাস্টম বিডিং অ্যালগরিদমের সাথে সর্বাধিক ব্যয় বিড কৌশল ব্যবহার করতে কীভাবে একটি লাইন আইটেম আপডেট করবেন তার একটি উদাহরণ এখানে দেওয়া হল:

জাভা

// Create the line item structure.
LineItem lineItem = new LineItem();

// Create and set the bidding strategy structure.
BiddingStrategy biddingStrategy = new BiddingStrategy();
MaximizeSpendBidStrategy maxSpendBidStrategy =
    new MaximizeSpendBidStrategy()
        .setPerformanceGoalType(
            "BIDDING_STRATEGY_PERFORMANCE_GOAL_TYPE_CUSTOM_ALGO")
        .setCustomBiddingAlgorithmId(custom-bidding-algorithm-id);
biddingStrategy.setMaximizeSpendAutoBid(maxSpendBidStrategy);
lineItem.setBidStrategy(biddingStrategy);

// Configure the patch request and set update mask to only update
// the bid strategy.
LineItems.Patch request =
    service
        .advertisers()
        .lineItems()
        .patch(advertiser-id, line-item-id, lineItem)
        .setUpdateMask("bidStrategy");

// Update the line item.
LineItem response = request.execute();

// Display the custom bidding algorithm ID used in the new
// bid strategy.
System.out.printf(
    "LineItem %s now has a bid strategy utilizing custom "
        + "bidding algorithm %s%n",
    response.getName(),
    response
        .getBidStrategy()
        .getMaximizeSpendAutoBid()
        .getCustomBiddingAlgorithmId());

পাইথন

# Create the new bid strategy object.
bidding_strategy = {
    'maximizeSpendAutoBid': {
        'performanceGoalType':
            'BIDDING_STRATEGY_PERFORMANCE_GOAL_TYPE_CUSTOM_ALGO',
        'customBiddingAlgorithmId': custom-bidding-algorithm-id
    }
}

# Create a line item object assigning the new bid strategy.
line_item_obj = {'bidStrategy': bidding_strategy}

# Update the line item with a new bid strategy.
response = service.advertisers().lineItems().patch(
    advertiserId=advertiser-id,
    lineItemId=line-item-id,
    updateMask='bidStrategy',
    body=line_item_obj).execute()

# Display the line item's new bid strategy
print(f'Line Item {response["name"]} is now using the following bid'
     f' strategy: {response["bidStrategy"]}.')

পিএইচপি

// Create the line item structure.
$lineItem = new Google_Service_DisplayVideo_LineItem();

// Create and set the bidding strategy structure.
$biddingStrategy =  new Google_Service_DisplayVideo_BiddingStrategy();
$maximizeSpendBidStrategy =
    new Google_Service_DisplayVideo_MaximizeSpendBidStrategy();
$maximizeSpendBidStrategy->setPerformanceGoalType(
    'BIDDING_STRATEGY_PERFORMANCE_GOAL_TYPE_CUSTOM_ALGO'
);
$maximizeSpendBidStrategy->setCustomBiddingAlgorithmId(
    custom-bidding-algorithm-id
);
$biddingStrategy->setMaximizeSpendAutoBid($maximizeSpendBidStrategy);
$lineItem->setBidStrategy($biddingStrategy);

// Set update mask.
$optParams = array('updateMask' => 'bidStrategy');

// Update the line item.
$result = $this->service->advertisers_lineItems->patch(
    advertiser-id,
    line-item-id,
    $lineItem,
    $optParams
);

// Display the custom bidding algorithm ID used in the new bid strategy.
printf(
    'Line Item %s now has a bid strategy utilizing custom bidding algorithm %s.\n',
    $result['name'],
    $result['bidStrategy']['maximizeSpendBidStrategy']['customBiddingAlgorithmId']
);