When developing in Salesforce Marketing Cloud, many times you will come across the question of which language you should choose, and as usual, the answer is it depends. It depends on whether the development is in an email for a simple customization, it is in a cloudpage, if you need to interact with the creation of Data Extensions, or activate automations, etc. And other variables also have an influence, such as whether you prefer one type of encoding and syntax or another or more or less advanced error handling.
Before you start, don't forget to read the first chapter of this series "Development in Salesforce Marketing Cloud", where we make a general introduction as well as the main features of the 2 main programming languages.
Once we have that in mind, we can continue with this chapter...
In Marketing Cloud there are 2 main programming languages, AMPSCRIPT and SSJS (well, there are really 3, there is also GTL – Guided Template Language, although it is not being widely used).
- AMPscript – Salesforce Marketing Cloud proprietary language.
- Guided Template language [GTL] – to create templates based on JSON.
But let's focus again on the differences between Ampscript and SSJS, both can be used almost equally for customization, but this is where if you dive a little deeper into them you will see their most significant differences begin.
It is used for all kinds of customizations in emails (here it has no rival), landing pages, SMS, push notifications, etc. As we have already mentioned, it is proprietary and is executed by the SFMC application itself, it is executed during the sending of the email, so you can customize it as well as include scripts to record sending logs or any other option at the time of sending.
It has many functions made especially for this purpose, both to interact with Data Extensions, and to manage customizations and their formats.
But they don't just choose it for this reason, it has certain advantages at the language structure level:
You can make use of arrays (AMPSCRIPT NO, and it is one of its great disadvantages).
Math and EVAL functions.
It also has the option of the Core library for landing pages and applications, as well as WsProxy as an interface to use SOAP.
Preferred use cases for each language
Here we expose use cases and what should be the preferred language to use:
For the case of “INLINE” and simple customizations through IF conditionals or Loops, it is better to use AMPscript.
If the developer is not used to either of the 2 languages, then Ampscript offers a faster learning curve.
For application development and landing pages, if there is nothing specific that requires Ampscript, many developers prefer to "throw" SSJS.
In the case of sending emails and especially if they are numerous, it is better to avoid SSJS, because it is usually slower in execution than Ampscript and could slow down sending a lot.
If you require JSON in the development, SSJS has many advantages in its handling compared to AMPSCRIPT.
However, another aspect to take into account is the level of development and dedication, if your dedication to Marketing Cloud is sporadic or you are not a developer with some experience, you better bet on AMPSCRIPT, because it can generally cover most of General and basic aspects of the platform.
If you still want to delve deeper into all these languages, you can use these links:
If you liked this article, you may also be interested in:
- What is the Salesforce Marketing Cloud contact model?