Automatic Detection of Flash Asset Properties through the API

Monday, November 14, 2011 |

We had previously explored manually managing the clickTags of your Flash creatives through the DFA API. When you need to update a creative’s exits to point to new locations, this information can be very useful, but there is another useful option when you’re first creating a creative that uses Flash. DFA automatically detects several properties in Flash creative assets including clickTags, which you can use to avoid having to manually enter these values into a Flash creative.

The Flash asset’s detected properties are returned in the CreativeAssetSaveResult object obtained when saving the asset. These values will not be automatically pulled into any creatives later made using this asset; they must still be explicitly set when making a creative object. Fortunately the properties are returned as the same object types that can be put directly into a creative. Using these automatically detected values is as easy as copying them over from the result object. You can see how these values can be used in the following code snippet:

// Create the Flash creative asset and save it.
CreativeAsset flashAsset = new CreativeAsset();
flashAsset.setForHTMLCreatives(true);
flashAsset.setAdvertiserId(advertiserId);
flashAsset.setContent(getAssetDataFromFile(pathToFile));
flashAsset.setName(assetName);
CreativeAssetSaveResult flashAssetSaveResult =
service.saveCreativeAsset(flashAsset);

// Create a Flash in-page creative using data returned from saving the
// asset.
FlashInpageCreative flashCreative = new FlashInpageCreative();
flashCreative.setClickTags(
flashAssetSaveResult.getClickTags());

HTMLCreativeFlashAsset parentFlashAsset = new HTMLCreativeFlashAsset();
parentFlashAsset.setAssetFilename(flashAssetSaveResult.getSavedFilename());
parentFlashAsset.setFrameSize(flashAssetSaveResult.getFrameSize());
parentFlashAsset.setFlashVersion(
flashAssetSaveResult.getFlashVersion());
flashCreative.setParentFlashAsset(parentFlashAsset);

// Set the rest of the properties on the FlashInpageCreative and
// save it.

You can receive detected values again by grabbing the asset from our server and saving it unchanged. This will return another CreativeAssetSaveResult object without creating a duplicate creative asset. Having to request and then retransmit the entire Flash file can be a slow, heavyweight interaction, so you should avoid doing this when possible. If you’re using the same Flash asset to back multiple creatives, it is to your benefit to make all of your creatives while your asset’s save result object is still in scope rather than saving the same asset once per creative.

Questions about automatic detection of Flash properties or any DFA API topic are always welcome on our forum. Hope to see you there!
, the DFA API Team