Development in Salesforce Marketing Cloud: Ampscript or SSJS? – Part 1

Temática 

SF Marketing Cloud

When developing in Salesforce Marketing Cloud, many times you will find the question of which language you should choose, and as usual, the answer is “It depends”. It depends on whether the development you are working on is an email for simple customization, it is on a cloud page if you need to interact with the creation of Data Extensions, or activate automations, etc. And other variables also influence, such as when the differences are not many, or there is a preference for one type of coding or another.


AMPscript

 

Ampscript is Marketing Cloud’s proprietary code, for this reason, it fully adapts to Cloud marketing needs: customizations, landing page creation, SMS and push sending, and more advanced aspects that you can also do with this language.

It is designed to be as simple as possible and its syntax is very intuitive so that even non-technical profiles can go into this language to make customizations and then do more sophisticated things.

 

AMPscript Features

 

AMPscript can be used for: 

 

  • Customize communications via email, using the information of your users and even additional data in related tables.

  • Create any combination or complex logical structures with dynamic content.

  • Clean and format the data.

  • Add dates or calculations on them: x days until ….

  • Create dynamic pages or make complex data transactions.

ampscript

 

And these are just small and simple things that can be done, but that can give infinitely greater value to all your communications to adapt them to each need and moment of your users.

 

Type of functions 

Description

API 

Through this language, interactions with Marketing Cloud can be carried out through SOAP-API

Contacts 

Subscriber information can be modified in All Subscribers

Content 

You can manage content elements, images, texts in emails, etc.

Data Extension 

Data Extensions information can be modified and consulted

Date Time 

For date management

Encryption 

Functions to encrypt and decrypt

HTTP 

Get, post 

Math 

Basic math functions

Microsoft Dynamics CRM 

Interact with Microsoft Dynamics CRM

Salesforce 

Query, insert and update information in Sales, Service Cloud data and Marketing Cloud

Sites 

Functions for managing Cloud Pages

Social 

Using social sharing features in Email Studio

String 

Management of text functions

 

Undoubtedly, one of the great advantages of Marketing Cloud is having several languages ​​to include in its different elements: emails, cloud pages, SMS messages, push. This gives unlimited possibilities of using the tool and adapting the communication to the user.

Advantages and uses of AMPscript in Marketing Cloud

  • Emails with absolute customization at a commercial level.

  • Emails from virtual stores with multiple possibilities: abandoned cart, purchase confirmation, re-enlisting sleeping customers, suggestions for complementary products and much more.

  • Equally complex transactional emails.

  • Personal and feature-rich landing pages: entry forms, registration, event agenda, whatever you need to fit your communication strategy.

{{cta(’52fa9c99-860e-4fbd-b8e0-8084060f20e8′,’justifycenter’)}}

 

Server Side Javascript – SSJS 

 

Ampscript is not the only language that can be used in Marketing Cloud, another of those available is a version of javascript that runs from the server side and includes certain additional libraries to interact with Marketing Cloud.

 

One of the substantial advantages of SSJS is error control, much more developed than in Ampscript via the typical:

 

try{ 

}  catch(e) { 

Write(Stringify(e.message)); 

 

It is a language that some developers are very familiar with.

 

It has WSProxy, which allows you to easily extend SOAP calls that give enormous power to any development.

 
But not all are advantages, we will see that it also has certain disadvantages, mainly at the performance level.

 

SSJS Libraries 

 

It has 2 libraries and, in some cases, they overlap in various functionalities.


 
Both libraries use JSON and Javascript. A question that one asks is which one should be used in each case, and this is easily answered:

 

  • If you are including SSJS in an email or SMS you must use the so-called Platform library.

  • If you are creating applications or landing pages, the library to use is the Core library.

ssjs-wsproxy

 

The functions used in SJSS to interact with the Marketing Cloud are in many cases replicas of Ampscript and always start with the word Platform.

 

Therefore, in SSJS you can access most of the functions to interact with Ampscript’s Marketing Cloud and also add some advantages; better error handling and WS-Proxy for advanced functionalities (dynamic DE creation, execution or creation of automations, content management and creation, etc.):

 

  • Read and modify contact information

  • Read and modify content

  • Add, modify and delete information in Data Extensions

  • Using date and time functions

  • Create and send emails and “triggered sends”

  • Add, modify and delete subscriber information

  • HTTP functions.

  • Variety of utility functions, evaluation, security…

Furthermore, SSJS can use these methods (as well as the aforementioned WS-Proxy, which we will see in more detail in later articles):

 

Método 

Functionality

Add 

Invokes the Create method of the SOAP API object 

Remove 

Invokes the Delete method of the SOAP API object 

Update 

Invokes the Update method of the SOAP API object 

Retrieve 

Invokes the Retrieve method of the SOAP API object

 

 

With this first article, you can get a little idea of ​​the 2 main programming languages ​​that Marketing Cloud has. And, later on, we will delve into its main advantages and disadvantages, as well as its processing speed (which varies quite a bit, depending on what you want to do).

 


 

If you liked this article, you may also be interested in:

 

{{cta(‘c533b742-eee9-41d5-87e1-81c9a5c7f393′,’justifycenter’)}}

Últimas entradas
Suscríbete a nuestra newsletter

Post relacionados de SF Marketing Cloud que pueden ser de tu interés

Sorry, No posts.