5

Simple question: how do you guys develop (write) a landing page and test it? Publishing and waiting for updating url and refreshing?

Isn't that a little bit "horrible"?

Any idea of developing and testing with cloudpages?

How can I see errors in my ampscript code when my landing url throws a 500 error?

Thank you!

2 Answers 2

10

I use the HTTPGET() AMPScript function to pull in the content from an external web server when developing pages. Like this:

%%=TreatAsContent(HttpGet(Concat("http://example.com/your-page.html?x=",GUID())))=%%

Then when everything is functional, then I copy the code from the web server back into the Cloud Pages and publish it.

This method also works for email development.

6
  • Can I use this trick for ampscript too? Ty !
    – MrViSiOn
    Oct 28, 2016 at 7:30
  • Yes, the ampscript can be written and stored on the external web server, but will not be evaluated. The TreatAsContent function in the landing page code will evaluate the ampscript stored in the external file. Nov 16, 2016 at 22:05
  • 2
    If the ampscript contains syntax error, the page may still return a generic 500 error. I try to avoid this by wrapping the ampscript code in the landing page with a SSJS try catch statement. (reference: salesforce.stackexchange.com/questions/141302/…) Nov 16, 2016 at 22:11
  • Adam, best advice ever. This will save me hours and hours of waiting for MC Landingpages !!
    – Michael H
    Jul 20, 2017 at 16:57
  • This is an awesome solution! Oct 9, 2020 at 15:27
2

I use the ContentBlockbyKey() AMPScript function in the landing page, to pull in the main body of code from a content block, like this:

%%=ContentBlockbyKey("ContentBlockTestSSJS")=%%

On each request of the landing page, the referenced content block resolves to whatever updates I've saved regardless of any caching. So you don't have to wait 5 minutes to test your page.

This method does not work if you have client side JavaScript in the content block - it seems that Content Builder strips out client side JS. But it does work for all AMPscript, HTML, CSS and SSJS.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .