Test AMPscript Content Locally

The AMPscript Core extension can create a web server hosted on your local computer. You can view your AMPscript content on this server using your web browser.

The extension launches a server on your computer on port 5000. You can start the server from within Visual Studio Code.

  1. In Visual Studio Code, go to File > Open Folder.
  2. Select the folder that you cloned the Git repository into.
  3. In the Visual Studio file explorer, open the folder example/dd4tmp. Click the file dd4tmp.ampscript.
  4. Click the Run and Debug icon (The Run & Debug button in Visual Studio Code. The button has an equilateral triangle pointing to the right. In the lower left corner, there’s an image of an insect.), and then click Run and Debug. The example file opens in your web browser.

If the file doesn’t automatically open in your web browser, you can view it by entering localhost:5000 in your browser's address bar.

You can modify the example content to see several of the ways in which AMPscript can personalize content for your recipients.

  1. Open the file example/dd4tmp/subscriber.json. This file represents the subscriber data that can be used to personalize the message.
  2. Change some of the values in the file, and then reload the example page in your web browser. You can change several values to see changes in the file, including:
    • To view the message in other languages, change the value of Member_Langauge field to ES or CN.
    • To change the salutation, change the value of the first_name field.