Marketers / Marketing Cloud

AMPscript in Salesforce Marketing Cloud: Expectations vs. Reality

By Alina Makarova

When starting working with Salesforce Marketing Cloud, you quickly learn that in order to use all the fancy personalization and segmentation techniques that we marketers love so much, you need to roll up your sleeves and become a so-called technical marketer by learning a thing or two about coding. 

This article is all about AMPscript, Marketing Cloud’s native scripting language. It can be used for all sorts of personalization – including your CloudPages and for emails. As a non-technical person, getting the grip of AMPscript was quite a challenge, so I hope this post will make the journey for those just starting out a little easier. Consider it an AMPscript starter pack! 

Use a Visualization Tool

It’s extremely helpful when writing AMPscript to make sure you’re using a tool for visualization which will help you apply the styling rules to your code. No matter how short your code is in the start, it’s best to make this as a rule from the beginning. 

One thing I learned from writing code: the way you write matters. Any one wrong symbol can ruin it all – so the cleaner it is on your screen, the easier it is to find a mistake. Without the visualization tool, f you do make a mistake and see a red screen with errors from the platform, sure it’ll guide you to the part where you made a mistake, but it’ll barely help you understand what you’ve actually done wrong. 

Mind the Order in Your Code

This is something that I’m still not 100% sure of every time I write code. 

The key to the order of writing functions in AMPscript is to look at the code as a whole entity and not as separate commands. They need to logically follow each other and you need to make sure you open and close statements correctly – even if it means repeating the same close twice in order to properly close it.

When I first started I was not familiar with some ground rules. The hardest part was when I had more than two functions that needed to happen in the code and I didn’t know what to start with or how to combine them so they worked together.

I feel like there’s still a lack of information for beginners on how to start with AMPscript, especially when coding isn’t something you’ve ever encountered. For me, simply practicing and working out routine scenarios has helped. For example, start with the name personalization and stack it with the if statement, or combine the CONCAT to have the first name and have a look up. Once you master these ones, you’ll get the gist of it and will be able to move on to more complex scenarios. 

Become Familiar With the Resources Available

There are tons of resources that people in the Salesforce Marketing Cloud community have created on AMPScript – and you should make use of them all! Personally, these are the resources that I use to ensure that I’m writing the correct script:

  1. AMPscript Guide by Eliot Harper and Adam Spriggs: A great resource to help you familiarize yourself with all the possibilities there are for AMPScript. Although, it’s best used by those who have some knowledge of coding and I wouldn’t say that it’s 100% suited for people who are just starting to learn. 
  2. YouTube videos by Cameron Robert videos: These videos cover various scenarios that occur in AMPscript, so you’ll definitely find something for your needs.  Also, the video format is excellent  so you can follow the process, step-by-step. 
  3. ampscript.xyz by Ivan Razine: While this one has some advanced scenarios more suitable for AMPscript pros, it’s also interesting to explore unorthodox ways you can resolve certain personalization scenarios. 
  4. ampscript.io: An AMPscript tool that you can use to check your code.
  5. Salesforce StackExchange: This is the place where you can find the answers to most of your questions. I  leverage it when I don’t know how to figure something out – or when I’ve run into the same mistake for a millionth time. 

Leverage ChatGPT

When ChatGPT became a part of our daily lives, I started learning more about AMPScript. It really helped me to understand the specific mistakes I’ve been making and how to improve – something which guides and resources cant do.

It takes your issue and gives you back the information you need and at a level that you can understand. It’s perfect as a personal trainer tool, but you should always check the code it produces.

Note: Make sure you don’t input your customer data into ChatGPT.

READ MORE: Can ChatGPT Replace a Salesforce Marketer?

Participate in Challenges to Learn Faster

Lastly, I wanted to mention a great initiative that was an inspiration for this post: Sabuhi Yahyayev’s 30 day AMPscript challenge. I completed it recently and it really helped me to grasp not only the technical aspects of writing code, but it also served as an inspiration to how you can use it. 

Once you become more proficient with AMPscript, you will see how many personalization and segmentation scenarios you can accomplish. This is when coding becomes exciting –  delivering personalization campaigns that you would have never realized you could accomplish!

Summary

I really hope this article helps out all you beginners starting to learn the world of AMPscript – it’s not as scary as it looks! 

The main goal is to create amazing marketing campaigns, but as an extra perk, there’s nothing quite as satisfying as that feeling of pure relief when you finally crack the code after spending hours trying to figure out what went wrong. So go ahead, dive in, and enjoy the journey!

The Author

Alina Makarova

Alina is a Digital Marketing Consultant at Capgemini.

Leave a Reply