Hosting images used in your ads on Box is an easy way to get started quickly with a product feed for dynamic or automated campaigns. However, there are a couple of things you need to take into account when doing this:
- To use files hosted on Box, the files have to be accessible publicly to everyone in Box's sharing settings (People with the link Can view and download)
When hosting images on Box, the default sharing option only allows for viewing the images online, but not downloading them. This means that if you use the default sharing URLs or images for your feed, the images will not be downloaded and will cause an error. This can be resolved by changing the URLs from the browser as follows:
Change the URLs from this structure: https://app.box.com/file/FILE_ID?s=KEY
to this structure: https://app.box.com/index.php?rm=box_download_shared_file&file_id=f_FILE_ID&shared_name=KEY.
The FILE_ID is the long string of numbers and letters in the middle of the sharing URL, KEY is the one at the end.
To test that the change successfully worked, simply follow the edited link URL in your browser. If it doesn't open a new window or tab, but instead your browser starts to download the file, everything should be working as intended.
Sharable link won't work.
Automated options
On Google Sheets
You can automatically modify the URLs by using the CONCATENAT, REGEXEXTRACT and SUBSTITUTE functions in a sheet. When doing this, the original URLs would be in one column, and the modified URLs in another. For example, if you have the URLs in the A column starting from A2, you can insert the following expression into B2 and then copy it to other cells as well:
=IF(ISBLANK(A2),"",CONCATENATE("https://app.box.com/index.php?rm=box_download_shared_file&file_id=f_",SUBSTITUTE(REGEXEXTRACT(A2,"file/(.*)~?") ,"?s=","&shared_name=")) )
By creating a new field in your Automation Feed
- Go to Automation Feeds and click your feed name.
- At the bottom left, click on Select field.
- Choose Liquid template.
- Name your destination field and paste the following formula:
{% assign file_id = FIELD_NAME | split: "/file/" | last | split: "?s=" | first %}
{% assign shared_name = file_url | split: "?s=" | last %}
https://app.box.com/index.php?rm=box_download_shared_file&file_id=f_{{ file_id }}&shared_name={{ shared_name }}
Make sure to replace FIELD_NAME with the field that contains your Box URL.