コード例 #1
0
        /// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="service">An initialized Dfa Reporting service object
        /// </param>
        public override void Run(DfareportingService service)
        {
            long advertiserId = long.Parse(_T("INSERT_ADVERTISER_ID_HERE"));
            long sizeId       = long.Parse(_T("INSERT_SIZE_ID_HERE"));
            long profileId    = long.Parse(_T("INSERT_USER_PROFILE_ID_HERE"));

            string pathToHtml5AssetFile = _T("INSERT_PATH_TO_HTML5_ASSET_FILE_HERE");
            string pathToImageAssetFile = _T("INSERT_PATH_TO_IMAGE_ASSET_FILE_HERE");

            Creative creative = new Creative();

            creative.AdvertiserId = advertiserId;
            creative.Name         = "Test HTML5 banner creative";
            creative.Size         = new Size()
            {
                Id = sizeId
            };
            creative.Type = "HTML5_BANNER";

            // Upload the HTML5 asset.
            CreativeAssetUtils assetUtils   = new CreativeAssetUtils(service, profileId, advertiserId);
            CreativeAssetId    html5AssetId = assetUtils.uploadAsset(pathToHtml5AssetFile, "HTML");

            CreativeAsset html5Asset = new CreativeAsset();

            html5Asset.AssetIdentifier = html5AssetId;
            html5Asset.Role            = "PRIMARY";

            // Upload the backup image asset.
            CreativeAssetId imageAssetId = assetUtils.uploadAsset(pathToImageAssetFile, "HTML_IMAGE");

            CreativeAsset imageAsset = new CreativeAsset();

            imageAsset.AssetIdentifier = imageAssetId;
            imageAsset.Role            = "BACKUP_IMAGE";

            // Add the creative assets.
            creative.CreativeAssets = new List <CreativeAsset>()
            {
                html5Asset, imageAsset
            };

            // Add a click tag.
            ClickTag clickTag = new ClickTag()
            {
                Name = "clickTag"
            };

            creative.ClickTags = new List <ClickTag>()
            {
                clickTag
            };

            Creative result = service.Creatives.Insert(creative, profileId).Execute();

            // Display the new creative ID.
            Console.WriteLine("HTML5 banner creative with ID {0} was created.", result.Id);
        }
    /// <summary>
    /// Run the code example.
    /// </summary>
    /// <param name="service">An initialized Dfa Reporting service object
    /// </param>
    public override void Run(DfareportingService service) {
      long advertiserId = long.Parse(_T("INSERT_ADVERTISER_ID_HERE"));
      long sizeId = long.Parse(_T("INSERT_SIZE_ID_HERE"));
      long profileId = long.Parse(_T("INSERT_USER_PROFILE_ID_HERE"));

      string pathToHtmlAssetFile = _T("INSERT_PATH_TO_HTML_ASSET_FILE_HERE");
      string pathToImageAssetFile = _T("INSERT_PATH_TO_IMAGE_ASSET_FILE_HERE");

      Creative creative = new Creative();
      creative.AdvertiserId = advertiserId;
      creative.Name = "Test enhanced banner creative";
      creative.Size = new Size() { Id = sizeId };
      creative.Type = "ENHANCED_BANNER";

      // Upload the HTML asset.
      CreativeAssetUtils assetUtils = new CreativeAssetUtils(service, profileId, advertiserId);
      CreativeAssetId htmlAssetId = assetUtils.uploadAsset(pathToHtmlAssetFile, "HTML");

      CreativeAsset htmlAsset = new CreativeAsset();
      htmlAsset.AssetIdentifier = htmlAssetId;
      htmlAsset.Role = "PRIMARY";
      htmlAsset.WindowMode = "TRANSPARENT";

      // Upload the backup image asset.
      CreativeAssetId backupImageAssetId =
          assetUtils.uploadAsset(pathToImageAssetFile, "HTML_IMAGE");

      CreativeAsset backupImageAsset = new CreativeAsset();
      backupImageAsset.AssetIdentifier = backupImageAssetId;
      backupImageAsset.Role = "BACKUP_IMAGE";

      // Add the creative assets.
      creative.CreativeAssets = new List<CreativeAsset>() { htmlAsset, backupImageAsset };

      // Configure the backup image.
      creative.BackupImageClickThroughUrl = "https://www.google.com";
      creative.BackupImageReportingLabel = "backup";
      creative.BackupImageTargetWindow = new TargetWindow() { TargetWindowOption = "NEW_WINDOW" };

      // Add a click tag.
      ClickTag clickTag = new ClickTag();
      clickTag.Name = "clickTag";
      clickTag.EventName = "exit";
      clickTag.Value = "https://www.google.com";
      creative.ClickTags = new List<ClickTag>() { clickTag };

      Creative result = service.Creatives.Insert(creative, profileId).Execute();

      // Display the new creative ID.
      Console.WriteLine("Enhanced banner creative with ID {0} was created.", result.Id);
    }
        /// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="service">An initialized Dfa Reporting service object
        /// </param>
        public override void Run(DfareportingService service)
        {
            long advertiserId = long.Parse(_T("INSERT_ADVERTISER_ID_HERE"));
            long sizeId       = long.Parse(_T("INSERT_SIZE_ID_HERE"));
            long profileId    = long.Parse(_T("INSERT_USER_PROFILE_ID_HERE"));

            string pathToImageAssetFile  = _T("INSERT_PATH_TO_IMAGE_ASSET_FILE_HERE");
            string pathToImageAsset2File = _T("INSERT_PATH_TO_IMAGE_ASSET_FILE_HERE");

            Creative creative = new Creative();

            creative.AdvertiserId      = advertiserId;
            creative.AutoAdvanceImages = true;
            creative.Name = "Test display image gallery creative";
            creative.Size = new Size()
            {
                Id = sizeId
            };
            creative.Type = "DISPLAY_IMAGE_GALLERY";

            // Upload the first image asset.
            CreativeAssetUtils assetUtils    = new CreativeAssetUtils(service, profileId, advertiserId);
            CreativeAssetId    imageAsset1Id =
                assetUtils.uploadAsset(pathToImageAssetFile, "HTML_IMAGE").AssetIdentifier;

            CreativeAsset imageAsset1 = new CreativeAsset();

            imageAsset1.AssetIdentifier = imageAsset1Id;
            imageAsset1.Role            = "PRIMARY";

            // Upload the second image asset.
            CreativeAssetId imageAsset2Id =
                assetUtils.uploadAsset(pathToImageAsset2File, "HTML_IMAGE").AssetIdentifier;

            CreativeAsset imageAsset2 = new CreativeAsset();

            imageAsset2.AssetIdentifier = imageAsset2Id;
            imageAsset2.Role            = "PRIMARY";

            // Add the creative assets.
            creative.CreativeAssets = new List <CreativeAsset>()
            {
                imageAsset1, imageAsset2
            };

            // Create a click tag for the first image asset.
            ClickTag clickTag1 = new ClickTag();

            clickTag1.Name      = imageAsset1Id.Name;
            clickTag1.EventName = imageAsset1Id.Name;

            // Create a click tag for the second image asset.
            ClickTag clickTag2 = new ClickTag();

            clickTag2.Name      = imageAsset2Id.Name;
            clickTag2.EventName = imageAsset2Id.Name;

            // Add the click tags.
            creative.ClickTags = new List <ClickTag>()
            {
                clickTag1, clickTag2
            };

            Creative result = service.Creatives.Insert(creative, profileId).Execute();

            // Display the new creative ID.
            Console.WriteLine("Display image gallery creative with ID {0} was created.", result.Id);
        }
コード例 #4
0
        /// <summary>
        /// Run the code example.
        /// </summary>
        /// <param name="service">An initialized Dfa Reporting service object
        /// </param>
        public override void Run(DfareportingService service)
        {
            long advertiserId = long.Parse(_T("INSERT_ADVERTISER_ID_HERE"));
            long sizeId       = long.Parse(_T("INSERT_SIZE_ID_HERE"));
            long profileId    = long.Parse(_T("INSERT_USER_PROFILE_ID_HERE"));

            string pathToHtml5AssetFile = _T("INSERT_PATH_TO_HTML5_ASSET_FILE_HERE");
            string pathToImageAssetFile = _T("INSERT_PATH_TO_IMAGE_ASSET_FILE_HERE");

            Creative creative = new Creative();

            creative.AdvertiserId = advertiserId;
            creative.Name         = "Test HTML5 display creative";
            creative.Size         = new Size()
            {
                Id = sizeId
            };
            creative.Type = "DISPLAY";

            // Upload the HTML5 asset.
            CreativeAssetUtils assetUtils   = new CreativeAssetUtils(service, profileId, advertiserId);
            CreativeAssetId    html5AssetId =
                assetUtils.uploadAsset(pathToHtml5AssetFile, "HTML").AssetIdentifier;

            CreativeAsset html5Asset = new CreativeAsset();

            html5Asset.AssetIdentifier = html5AssetId;
            html5Asset.Role            = "PRIMARY";

            // Upload the backup image asset.
            CreativeAssetId imageAssetId =
                assetUtils.uploadAsset(pathToImageAssetFile, "HTML_IMAGE").AssetIdentifier;

            CreativeAsset imageAsset = new CreativeAsset();

            imageAsset.AssetIdentifier = imageAssetId;
            imageAsset.Role            = "BACKUP_IMAGE";

            // Add the creative assets.
            creative.CreativeAssets = new List <CreativeAsset>()
            {
                html5Asset, imageAsset
            };

            // Configure the bacup image.
            creative.BackupImageClickThroughUrl = "https://www.google.com";
            creative.BackupImageReportingLabel  = "backup";
            creative.BackupImageTargetWindow    = new TargetWindow()
            {
                TargetWindowOption = "NEW_WINDOW"
            };

            // Add a click tag.
            ClickTag clickTag = new ClickTag();

            clickTag.Name      = "clickTag";
            clickTag.EventName = "exit";
            clickTag.Value     = "https://www.google.com";
            creative.ClickTags = new List <ClickTag>()
            {
                clickTag
            };

            Creative result = service.Creatives.Insert(creative, profileId).Execute();

            // Display the new creative ID.
            Console.WriteLine("HTML5 display creative with ID {0} was created.", result.Id);
        }
    /// <summary>
    /// Run the code example.
    /// </summary>
    /// <param name="service">An initialized Dfa Reporting service object
    /// </param>
    public override void Run(DfareportingService service) {
      long advertiserId = long.Parse(_T("INSERT_ADVERTISER_ID_HERE"));
      long sizeId = long.Parse(_T("INSERT_SIZE_ID_HERE"));
      long profileId = long.Parse(_T("INSERT_USER_PROFILE_ID_HERE"));

      string pathToHtml5AssetFile = _T("INSERT_PATH_TO_HTML5_ASSET_FILE_HERE");
      string pathToImageAssetFile = _T("INSERT_PATH_TO_IMAGE_ASSET_FILE_HERE");

      Creative creative = new Creative();
      creative.AdvertiserId = advertiserId;
      creative.Name = "Test HTML5 banner creative";
      creative.Size = new Size() { Id = sizeId };
      creative.Type = "HTML5_BANNER";

      // Upload the HTML5 asset.
      CreativeAssetUtils assetUtils = new CreativeAssetUtils(service, profileId, advertiserId);
      CreativeAssetId html5AssetId = assetUtils.uploadAsset(pathToHtml5AssetFile, "HTML");

      CreativeAsset html5Asset = new CreativeAsset();
      html5Asset.AssetIdentifier = html5AssetId;
      html5Asset.Role = "PRIMARY";

      // Upload the backup image asset.
      CreativeAssetId imageAssetId = assetUtils.uploadAsset(pathToImageAssetFile, "HTML_IMAGE");

      CreativeAsset imageAsset = new CreativeAsset();
      imageAsset.AssetIdentifier = imageAssetId;
      imageAsset.Role = "BACKUP_IMAGE";

      // Add the creative assets.
      creative.CreativeAssets = new List<CreativeAsset>() { html5Asset, imageAsset };

      // Add a click tag.
      ClickTag clickTag = new ClickTag() { Name = "clickTag" };
      creative.ClickTags = new List<ClickTag>() { clickTag };

      Creative result = service.Creatives.Insert(creative, profileId).Execute();

      // Display the new creative ID.
      Console.WriteLine("HTML5 banner creative with ID {0} was created.", result.Id);
    }
    /// <summary>
    /// Run the code example.
    /// </summary>
    /// <param name="service">An initialized Dfa Reporting service object
    /// </param>
    public override void Run(DfareportingService service) {
      long advertiserId = long.Parse(_T("INSERT_ADVERTISER_ID_HERE"));
      long sizeId = long.Parse(_T("INSERT_SIZE_ID_HERE"));
      long profileId = long.Parse(_T("INSERT_USER_PROFILE_ID_HERE"));

      string pathToImageAssetFile = _T("INSERT_PATH_TO_IMAGE_ASSET_FILE_HERE");
      string pathToImageAsset2File = _T("INSERT_PATH_TO_IMAGE_ASSET_FILE_HERE");

      Creative creative = new Creative();
      creative.AdvertiserId = advertiserId;
      creative.AutoAdvanceImages = true;
      creative.Name = "Test enhanced image creative";
      creative.Size = new Size() { Id = sizeId };
      creative.Type = "ENHANCED_IMAGE";

      // Upload the first image asset.
      CreativeAssetUtils assetUtils = new CreativeAssetUtils(service, profileId, advertiserId);
      CreativeAssetId imageAsset1Id = assetUtils.uploadAsset(pathToImageAssetFile, "HTML_IMAGE");

      CreativeAsset imageAsset1 = new CreativeAsset();
      imageAsset1.AssetIdentifier = imageAsset1Id;
      imageAsset1.Role = "PRIMARY";

      // Upload the second image asset.
      CreativeAssetId imageAsset2Id = assetUtils.uploadAsset(pathToImageAsset2File, "HTML_IMAGE");

      CreativeAsset imageAsset2 = new CreativeAsset();
      imageAsset2.AssetIdentifier = imageAsset2Id;
      imageAsset2.Role = "PRIMARY";

      // Add the creative assets.
      creative.CreativeAssets = new List<CreativeAsset>() { imageAsset1, imageAsset2 };

      // Create a click tag for the first image asset.
      ClickTag clickTag1 = new ClickTag();
      clickTag1.Name = imageAsset1Id.Name;
      clickTag1.EventName = imageAsset1Id.Name;

      // Create a click tag for the second image asset.
      ClickTag clickTag2 = new ClickTag();
      clickTag2.Name = imageAsset2Id.Name;
      clickTag2.EventName = imageAsset2Id.Name;

      // Add the click tags.
      creative.ClickTags = new List<ClickTag>() { clickTag1, clickTag2 };

      Creative result = service.Creatives.Insert(creative, profileId).Execute();

      // Display the new creative ID.
      Console.WriteLine("Enhanced image creative with ID {0} was created.", result.Id);
    }