Saturday, January 8, 2022

Reference all assets in an Asset Library directory or folder - Studio Help [gg-richmedia-en]

Reference all assets in an Asset Library directory or folder

This article applies only to dynamic creatives that use feeds, and this feature is not available for all accounts. Please contact Google Marketing Platform support to enable this feature.

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:

  1. 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 not DRM_Asset.

    Example Dynamic directory path:

    DRM_Directory:ourfolder/where we host our assets/
  2. 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/
  3. 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" :  ""},"image1_salad.jpg" : {"Type" : "file", "Url" :  ""},"image1_salad_old.jpg" : {"Type" : "file", "Url" :  ""}};  
  4. 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 content ALFolder 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;  
  5. 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;  

No comments:

Post a Comment

Search This Blog

Check for new unassociated label [MS]

Check for new unassociated label Access for Microsoft 365 Access 2021 Acc...