/**
  * (non-PHPdoc)
  * @see BaseExample::run()
  */
 public function run()
 {
     $values = $this->formValues;
     printf('<h2>Creating flash in-page banner creative from flash asset "%s"</h2>', $values['flash_asset_file']['name']);
     $creative = new Google_Service_Dfareporting_Creative();
     $creative->setAdvertiserId($values['advertiser_id']);
     $creative->setAutoAdvanceImages(true);
     $creative->setName('Test flash in-page creative');
     $creative->setType('FLASH_INPAGE');
     $size = new Google_Service_Dfareporting_Size();
     $size->setId($values['size_id']);
     $creative->setSize($size);
     // Upload the flash asset.
     $flash_asset_id = uploadAsset($this->service, $values['user_profile_id'], $values['advertiser_id'], $values['flash_asset_file'], 'FLASH');
     $flash_asset = new Google_Service_Dfareporting_CreativeAsset();
     $flash_asset->setAssetIdentifier($flash_asset_id);
     $flash_asset->setRole('PRIMARY');
     $flash_asset->setWindowMode('TRANSPARENT');
     // Upload the backup image asset.
     $image_asset_id = uploadAsset($this->service, $values['user_profile_id'], $values['advertiser_id'], $values['image_asset_file'], 'HTML_IMAGE');
     $image_asset = new Google_Service_Dfareporting_CreativeAsset();
     $image_asset->setAssetIdentifier($image_asset_id);
     $image_asset->setRole('BACKUP_IMAGE');
     // Add the creative assets.
     $creative->setCreativeAssets(array($flash_asset, $image_asset));
     // Set up the backup image target window option.
     $target_window = new Google_Service_Dfareporting_TargetWindow();
     $target_window->setTargetWindowOption('NEW_WINDOW');
     $creative->setBackupImageTargetWindow($target_window);
     $result = $this->service->creatives->insert($values['user_profile_id'], $creative);
     $this->printResultsTable('Flash in-page creative created.', array($result));
 }
 /**
  * (non-PHPdoc)
  * @see BaseExample::run()
  */
 public function run()
 {
     $values = $this->formValues;
     printf('<h2>Creating enhanced banner creative from HTML5 asset "%s"</h2>', $values['html_asset_file']['name']);
     $creative = new Google_Service_Dfareporting_Creative();
     $creative->setAdvertiserId($values['advertiser_id']);
     $creative->setName('Test enhanced banner creative');
     $creative->setType('ENHANCED_BANNER');
     $size = new Google_Service_Dfareporting_Size();
     $size->setId($values['size_id']);
     $creative->setSize($size);
     // Upload the HTML5 asset.
     $html_asset_id = uploadAsset($this->service, $values['user_profile_id'], $values['advertiser_id'], $values['html_asset_file'], 'HTML');
     $html_asset = new Google_Service_Dfareporting_CreativeAsset();
     $html_asset->setAssetIdentifier($html_asset_id);
     $html_asset->setRole('PRIMARY');
     $html_asset->setWindowMode('TRANSPARENT');
     // Upload the backup image asset.
     $image_asset_id = uploadAsset($this->service, $values['user_profile_id'], $values['advertiser_id'], $values['image_asset_file'], 'HTML_IMAGE');
     $image_asset = new Google_Service_Dfareporting_CreativeAsset();
     $image_asset->setAssetIdentifier($image_asset_id);
     $image_asset->setRole('BACKUP_IMAGE');
     // Add the creative assets.
     $creative->setCreativeAssets(array($html_asset, $image_asset));
     // Configure the backup image.
     $creative->setBackupImageClickThroughUrl('https://www.google.com');
     $creative->setBackupImageReportingLabel('backup');
     $target_window = new Google_Service_Dfareporting_TargetWindow();
     $target_window->setTargetWindowOption('NEW_WINDOW');
     $creative->setBackupImageTargetWindow($target_window);
     // Add a click tag.
     $click_tag = new Google_Service_Dfareporting_ClickTag();
     $click_tag->setName('clickTag');
     $click_tag->setEventName('exit');
     $click_tag->setValue('https://www.google.com');
     $creative->setClickTags(array($click_tag));
     $result = $this->service->creatives->insert($values['user_profile_id'], $creative);
     $this->printResultsTable('Enhanced banner creative created.', array($result));
 }