Introduction
Developing in Marketing Cloud poses unique challenges, particularly when dealing with CloudPages or Script Activities. Publishing a CloudPage may require up to five minutes, during which you're left wondering whether your updates are live or if there's an issue with your code.
Based on my experience, the key to a fulfilling and effective Marketing Cloud development journey lies in establishing an environment optimised for iterative testing.
This guide aims to help you build such an environment.
Hosting
The first step to proper development is to get yourself a hosting environment which has a public facing URL. Personally, I enjoy AwardSpace.com because it also allows for FTP access, to quickly upload my local files using VSCode.
Step 1: Sign Up for Free Hosting
Navigate to awardspace.com and select the "FreeHosting" option on the main page.
Complete the registration process through one of the offered methods.
Step 2: Establish a Free Subdomain
Access the "Hosting Tools" menu and choose "Domain Manager."
Click on "Create a free subdomain," enter your desired subdomain name, and hit "Create."
Step 3: Generate the Web Page
Head over to "Hosting Tools" and select "File Manager."
Open the folder corresponding to your subdomain.
Choose "Create" and ensure "Create file" is selected.
Name the file something like "my-landing-page.html."
Step 4: Populate and Access Your Web Page
Great job, your web page is now live!
Open it to input your content.
Click "Save" after you've made your changes.
To access your live web page, use the URL displayed, omitting the "/home/www/" section.
For instance:
www.mytestdomain.atwebpages.com/my-landing-page.html
Step 5: Call the page from within Salesforce Marketing Cloud
We'll be leveraging two AMPScript functions to fetch content from an external site into our CloudPage.
HTTPGet: This function retrieves content from an external web page, requiring only the URL of the web page as an argument.
TreatAsContent: This function processes the data returned by HTTPGet as if it originated from a designated content area. This ensures that any AMPScript code on the external page is properly evaluated.
For instance, your Marketing Cloud CloudPage might include the following code snippet:
%%=TreatAsContent(HttpGet("http://mytestdomain.atwebpages.com/my-landing-page.html"))=%%
To modify the code, you only need to update the external web page. There's no need to re save and republish your CloudPage, as its content is dynamically fetched.
This approach eliminates the time lag associated with the conventional method of publishing and server propagation, making updates more efficient.
Step 6: Updating the hosted files using FTP
The files on the hosted server can now be updated directly using an FTP client, or a VSCode plugin (recommended)
1. In AwardSpace create a new FTP Account:
2. Make sure the path is using your subdomain.
Step 7: VSCode Plugin Setup
My recommended approach is to rather use VSCode’s ftp-simple plugin
1. Once installed, hit F1 and choose FTP Config like below:
2. Add in your FTP settings in the file like this:
3. Save the file.
Step 8: Using Simple FTP
It’s super simple to use the plugin!
1. When you have a file that you want to upload to the FTP, open it up in VSCode
2. Save the file before transferring
3. Press Ctrl + Shift + S
4. Select the following option:
5. Choose the FTP Server
6. Choose which file you would like to upload it to (either as a new file, or to overwrite an existing file)
NOTE: In MOST cases you’ll want to click on the existing file to overwrite it!
Step 9: Conclusion
And that’s it!
You can now view your Cloudpage and it will show the latest file you’ve just uploaded.
All in all, this Dev update process shouldn’t take more than 5 clicks and 10 seconds to update your CloudPage – WAY faster than copy/pasting and clicking publish each time.
Comentários