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

অ্যাপস স্ক্রিপ্ট থেকে ডাবলক্লিক ক্যাম্পেইন ম্যানেজার এবং ডাবলক্লিক ডিজিটাল মার্কেটিং রিপোর্টিং।

DoubleClick Campaigns পরিষেবা আপনাকে Google Apps Script-এ DCM/DFA Reporting and Trafficing API ব্যবহার করতে দেয়। এই API DoubleClick Campaign Manager (DCM) এবং DoubleClick Digital Marketing (DDM) রিপোর্টিং-এ প্রোগ্রাম্যাটিক অ্যাক্সেস প্রদান করে।

এটি একটি উন্নত পরিষেবা যা ব্যবহারের আগে সক্রিয় করতে হবে।

তথ্যসূত্র

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

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

নমুনা কোড

নিম্নলিখিত নমুনা কোডটি API এর সংস্করণ 4 ব্যবহার করে।

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

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

উন্নত/ডাবলক্লিক.জিএস
/**
 * 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);
  }
}

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

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

উন্নত/ডাবলক্লিক.জিএস
/**
 * 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);
  }
}

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

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

উন্নত/ডাবলক্লিক.জিএস
/**
 * 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);
  }
}