Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save katydorjee/9bb4a6fb4ee46ffe981c4220e7c3efca to your computer and use it in GitHub Desktop.
Save katydorjee/9bb4a6fb4ee46ffe981c4220e7c3efca to your computer and use it in GitHub Desktop.
Dropbox - SFMC CloudPage Consume content from Dropbox
<h1 style="text-align: center;">Debug mode: ON 🟢</h1><br>
<script runat='server'>
Platform.Load('Core','1');
try{
</script>
%%=TreatAsContent(HTTPGet('https://dl.dropbox.com/s/dropbox_file_Id/fileName.html'))=%%
<script runat='server'>
}catch (ex){
Write(Stringify(ex));
}
</script>
@katydorjee
Copy link
Author

katydorjee commented May 25, 2020

Marketing Cloud's 'CloudPage' utilises a caching mechanism to enhance performance. While this is beneficial when the page is live, it can be a hindrance during development, as caching significantly impacts development time. When you make changes to the page, it takes up to 7 minutes for the changes to reflect in the browser.

Below technique will help you to perform the development work (without waiting for caching).

Step1: Upload your file (in html format) to Dropbox, and get the shared link.
https://www.dropbox.com/s/dropbox_file_Id/sfmc_cp_test1.html?dl=0
Step2: Use below code in your Salesforce Marketing Cloud 'CloudPage'.
Insert dropbox URL as shown below:
%%=TreatAsContent(HTTPGet('https://dl.dropbox.com/s/dropbox_file_Id/fileName.html'))=%%

Step3: Save & Publish and then test your CloudPage.
Step4: Make some changes in dropbox file and save, see the updated content in your browser.
Step5: Once dev work is completed and tested, now it is ready for go LIVE, copy the code from your dropbox page and paste in CloudPage.
Step6: Remember to do the final testing.
Step7: Ready to go 👍

@katydorjee
Copy link
Author

There has been an update in the Dropbox shared URL pattern. The new pattern includes a security key in the query string, which also needs to be added to the Ampscript, as demonstrated below.

URL: https://www.dropbox.com/scl/fi/dropbox_file_Id/fileName.html?rlkey=keyInQueryString&dl=0

Sample code:
%%=TreatAsContent(HTTPGet('https://dl.dropbox.com/s/dropbox_file_Id/fileName.html?dl=0&rlkey=keyInQueryString'))=%%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment