Scripting Language References
Use scripting languages in Marketing Cloud Engagement to personalize landing pages, create applications, construct cross-channel templates, and work with messaging functions.
You'll need to understand scripting languages to use this functionality.
AMPscript is a scripting language that you can embed within HTML emails, text emails, landing pages, SMS messages, and push notifications from MobilePush. The system processes the script at the point where you include it in the message to render content on a subscriber-by-subscriber basis. Marketing Cloud Engagement processes AMPscript functions at send time.
For more information, see the AMPscript Developer's Guide.
Instead of using the browser to render the JavaScript on the client-side computer, Marketing Cloud Engagement processes SSJS on the server side. While you can duplicate the functionality of AMPscript using SSJS, SSJS doesn't work with the DOM and doesn't function with external libraries. All functions native to JavaScript, such as arrays, math functions, the EVAL function, and try catch blocks, work with SSJS.
SSJS interacts with Marketing Cloud Engagement by using several libraries. Write your code to work with these libraries in order to work with the information in your account. These libraries allow SSJS to be updated while maintaining previous versions in order to avoid breaking preexisting code. You can use all commands and syntax outlined in the JavaScript specifications as part of your SSJS offerings.
Several factors may influence your choice to use SSJS over AMPscript.
- AMPscript simply and efficiently handles inline personalization or simple IF ELSE statements.
- AMPscript better handles use cases, where each subscriber needs to see unique content, than SSJS.
- AMPscript has a shorter learning curve than SSJS for users new to scripting languages in general.
- JavaScript is widely known and used. Many developers can immediately apply their knowledge to Marketing Cloud Engagement.
- In general, the vast majority of users can handle the tasks they need to perform using AMPscript. Use Core library SSJS functions only to accomplish tasks on landing pages where AMPscript doesn't provide appropriate functions. SSJS functions can handle messaging tasks as well as landing pages and applications.
See Server-Side Javascript Guide.
GTL provides a declarative syntax used for creating personalized, dynamic, data-driven messages, as well as constructing cross-channel templates and layouts. GTL leverages the widely adopted Handlebars and Mustache template languages and provides additional functionality, while additionally simplifying how users interact with content and data to help them quickly build personalized Journey messages.