DoubleClick প্রচারাভিযান পরিষেবা

DoubleClick প্রচারাভিযান পরিষেবা আপনাকে Apps স্ক্রিপ্টে DCM/DFA রিপোর্টিং এবং ট্রাফিকিং API ব্যবহার করতে দেয়৷ এই API DoubleClick ক্যাম্পেইন ম্যানেজার (DCM) এবং DoubleClick ডিজিটাল মার্কেটিং (DDM) রিপোর্টিং-এ প্রোগ্রাম্যাটিক অ্যাক্সেস প্রদান করে।

রেফারেন্স

এই পরিষেবার বিস্তারিত তথ্যের জন্য, DCM/DFA রিপোর্টিং এবং ট্রাফিকিং API-এর রেফারেন্স ডকুমেন্টেশন দেখুন। Apps স্ক্রিপ্টের সমস্ত উন্নত পরিষেবাগুলির মতো, DoubleClick প্রচারাভিযান পরিষেবা সর্বজনীন API হিসাবে একই বস্তু, পদ্ধতি এবং পরামিতিগুলি ব্যবহার করে৷ আরও তথ্যের জন্য, দেখুন কিভাবে পদ্ধতি স্বাক্ষর নির্ধারণ করা হয়

সমস্যাগুলি রিপোর্ট করতে এবং অন্যান্য সহায়তা পেতে, DCM/DFA রিপোর্টিং এবং ট্রাফিকিং সহায়তা নির্দেশিকা দেখুন।

নমুনা কোড

নীচের নমুনা কোডটি API-এর সংস্করণ 3.3 ব্যবহার করে।

ব্যবহারকারীর প্রোফাইলের একটি তালিকা পান

এই নমুনা অ্যাকাউন্টে উপলব্ধ সমস্ত ব্যবহারকারীর প্রোফাইল লগ করে।

advanced/doubleclick.gs
/**
 * Logs all of the user profiles available in the account.
 */

function listUserProfiles() {
 
// Retrieve the list of available user profiles
 
try {
   
const profiles = DoubleClickCampaigns.UserProfiles.list();

   
if (profiles.items) {
     
// Print out the user ID and name of each
     
for (let i = 0; i < profiles.items.length; i++) {
       
const profile = profiles.items[i];
        console
.log('Found profile with ID %s and name "%s".',
            profile
.profileId, profile.userName);
     
}
   
}
 
} catch (e) {
   
// TODO (Developer) - Handle exception
    console
.log('Failed with error: %s', e.error);
 
}
}

সক্রিয় প্রচারাভিযানের একটি তালিকা পান

এই নমুনাটি সমস্ত সক্রিয় প্রচারাভিযানের নাম এবং আইডি লগ লগ করে। পুরো তালিকা পুনরুদ্ধার করতে পেজিং টোকেন ব্যবহার নোট করুন।

advanced/doubleclick.gs
/**
 * Logs names and ID's of all active campaigns.
 * Note the use of paging tokens to retrieve the whole list.
 */

function listActiveCampaigns() {
 
const profileId = '1234567'; // Replace with your profile ID.
 
const fields = 'nextPageToken,campaigns(id,name)';
  let result
;
  let pageToken
;
 
try {
   
do {
      result
= DoubleClickCampaigns.Campaigns.list(profileId, {
       
'archived': false,
       
'fields': fields,
       
'pageToken': pageToken
     
});
     
if (result.campaigns) {
       
for (let i = 0; i < result.campaigns.length; i++) {
         
const campaign = result.campaigns[i];
          console
.log('Found campaign with ID %s and name "%s".',
              campaign
.id, campaign.name);
       
}
     
}
      pageToken
= result.nextPageToken;
   
} while (pageToken);
 
} catch (e) {
   
// TODO (Developer) - Handle exception
    console
.log('Failed with error: %s', e.error);
 
}
}

একটি নতুন বিজ্ঞাপনদাতা এবং প্রচার তৈরি করুন

এই নমুনা একটি নতুন বিজ্ঞাপনদাতা তৈরি করে, এবং সেই বিজ্ঞাপনদাতার সাথে একটি নতুন প্রচারাভিযান তৈরি করে৷ অভিযান এক মাস ধরে চলবে।

advanced/doubleclick.gs
/**
 * Creates a new advertiser, and creates a new campaign with that advertiser.
 * The campaign is set to last for one month.
 */

function createAdvertiserAndCampaign() {
 
const profileId = '1234567'; // Replace with your profile ID.

 
const advertiser = {
    name
: 'Example Advertiser',
    status
: 'APPROVED'
 
};

 
try {
   
const advertiserId = DoubleClickCampaigns.Advertisers
       
.insert(advertiser, profileId).id;

   
const landingPage = {
      advertiserId
: advertiserId,
      archived
: false,
      name
: 'Example landing page',
      url
: 'https://www.google.com'
   
};
   
const landingPageId = DoubleClickCampaigns.AdvertiserLandingPages
       
.insert(landingPage, profileId).id;

   
const campaignStart = new Date();
   
// End campaign after 1 month.
   
const campaignEnd = new Date();
    campaignEnd
.setMonth(campaignEnd.getMonth() + 1);

   
const campaign = {
      advertiserId
: advertiserId,
      defaultLandingPageId
: landingPageId,
      name
: 'Example campaign',
      startDate
: Utilities.formatDate(campaignStart, 'GMT', 'yyyy-MM-dd'),
      endDate
: Utilities.formatDate(campaignEnd, 'GMT', 'yyyy-MM-dd')
   
};
   
DoubleClickCampaigns.Campaigns.insert(campaign, profileId);
 
} catch (e) {
   
// TODO (Developer) - Handle exception
    console
.log('Failed with error: %s', e.error);
 
}
}