If you want to reference all dynamic creative assets underneath a certain folder, you can do so by setting up Asset Library directories. We also refer to these directories as folder paths. Asset Library directories allow you to obtain all of the dynamic creative assets of the Asset Library folder in a JSON object format. In this object, key
is the name of the file, and value
is the location of the file on our internal CDN.
Studio will support the referencing of about 80 images or about 10 videos within the directory, assuming there is no other content in the feed such as additional columns. If your directory contains more images or videos, you may encounter payload issues with your creative. Because of this, we recommend that you only keep the images or videos you want to eventually send to the creative in a given folder.
To reference all assets in a folder:
-
In the Asset Library, click into the folder. A "Details" page displays on the right side of the window. Below the name of the folder and modified information, you will see the "Dynamic Path" for the current directory. Note that it begins with
DRM_Directory:
and notDRM_Asset
.Example Dynamic directory path:
DRM_Directory:ourfolder/where we host our assets/
-
Add the Dynamic directory path to your feed.
Below is a sample feed that includes assets from the Asset Library. Column B lists the Dynamic directory path:
A B Id ALFolder 1 DRM_Directory:ourfolder/where we host our assets/ -
In your Dynamic Profile, select the field type
AssetLibrary directory path
to access all assets in that folder.Example of the generated code in Studio:
dynamicContent.Sample_AssetDirectory_Application[0].ALFolder = {"image2_burger.jpg" : {"Type" : "file", "Url" : "https://s0.2mdn.net/ads/richmedia/studio/30933981/10030020_20140408091452935_image2_burger.jpg"},"image1_salad.jpg" : {"Type" : "file", "Url" : "https://s0.2mdn.net/ads/richmedia/studio/30933393/10030020_20140408091422952_image1_salad.jpg"},"image1_salad_old.jpg" : {"Type" : "file", "Url" : "https://s0.2mdn.net/ads/richmedia/studio/30933864/10030020_20140408091442259_image1_salad_old.jpg"}};
-
You can now get a reference to any file within that directory using just the file name of your asset. For example, if you want to load
image2_burger.jpg
, create a new variable to hold the URL path, set it equal to the dynamic contentALFolder
object passing in the file name, and indicate that you want the URL:var imageUrl = dynamicContent.Sample_AssetDirectory_Application[0].ALFolder["image2_burger.jpg"].Url;
- Load the image in your creative.
Set the source of an image element with the id
'food'
to load the dynamic image.For example, assume there's an image element in the HTML file:
<img id="food" src="default_food.jpg" height="140" width="180">
Using JavaScript, set the image's source using the
imageUrl
variable set in the previous step.document.getElementById('food').src = imageUrl;