Ampscript is one of the language of Salesforce Marketing Cloud. Ampscript runs on the servers of Salesforce Marketing Cloud. The code is embedded in the HTML emails, email text messages, landing pages, mobile phone messages, mobile app push notifications.

The code is rendered from top to bottom. What I mean is, it is an interpreted language. We do not need any special compiler to run it.

I mostly use it for email or any Salesforce Marketing Cloud message personalization. To create a personalized message, the Ampscript code needs to be interacting with the data model in the marketing cloud. The data mostly recorded in the Data Extensions of Marketing Cloud. In some case, the data may be in lists, or comes with json payloads thru an API interaction. In my following articles, I will give more information on how to interact with data.

When using Ampscript as Ampscript Block, the code is written between double percentage and squared brackets( %%[ ]%% )

This is an simple syntax of an Ampscript Block:

%%[

 var @firstName 
 var @lastName 
 set @firstName = "Mustafa"
 set @lastName = "Unlukara"

 ]%% 

The Ampscript code, when used in HTML (inline) is written in double percentage chars (%%).

Here is an simple example:

<html>
 <body>
Dear %%=v(@firstName)=%%  %%=v(@lastName)=%%,<br />Thank you for choosing our company as your service provider.
 </body>
</html>

You can also write your Ampscript code within and SSJS (Server Side Javascript) code.

Here is the syntax for it:

<script runat="server" language="ampscript"> 

/* Write your Ampscript code here.  */ 

</script>

Discover more from Marketing Cloud info

Subscribe now to keep reading and get access to the full archive.

Continue reading

Exit mobile version