Personalization techniques for SFMC from Marketing Champions

Personalization techniques for SFMC from Marketing Champions

Personalization is critical for any successful marketing campaign, so in our hunt for more pro tips, we asked a couple of experts to share some of their personalization techniques for SFMC. Here’s what they had to say.

Swati Bhalla, Sr. Specialist Email and Digital Channel at Salesforce

Personalization in SFMC is something every marketer dreams of, and we have many ways to personalize content and reach your audience at the right time with the right message.

Here are just a few personalization tools at your disposal:

  • Personalization string.
  • AMPscript.
  • Einstein.
  • Dynamic Content module.

I want to focus on the Dynamic Content module and how it helped me increase an open rate by 27% (and CTR by 4%) in just 30 days.


What is a dynamic content block?

A content block allows you to tailor your email campaign so that different contact groups receive different content, specific offers, images, copy, or calls to action. For example, you can send one campaign with multiple targeted messages for various customer groups.


How I used it

We were running a loyalty program campaign where all the members received similar content despite their loyalty level (e.g., whale, elephant, rhino. etc.)

We used a dynamic content block to tailor the content based on each loyalty level, personalized images, the sender’s signature, and subject lines.

We also used Einstein features for the campaign to understand the best open time for our audience, thus targeting them better. 

Having witnessed great results, we are now scaling it further by using the new SFMC feature – released trigger campaign messages. I’ve always been a fan of Journey Builder, and now, with this cool feature, I can target my audience based on their preferred channel by analyzing real-time data.


Ben Briggs, Solution Lead at Lev

Automating Serialized Coupon Codes

Regarding promo codes in emails, it’s ideal to have a proper integration between your commerce platforms, such as Salesforce Commerce Cloud and Salesforce Marketing Cloud. This way, you can push personalized promo codes directly into Marketing Cloud on a 1:1 basis.

While that’s not always practical, you don’t have to settle for giving everyone the same “WELCOME20” promo code and lose all redemption tracking and the impact of serialized codes.

In such situations, the claimrow function in AMPscript is particularly handy. This simple AMPscript function allows you to assign serialized promo codes for bulk importing.

There are many ways of achieving similar results, but I usually start by creating two data extensions:

The first data extension will hold all promo codes, regardless of redemption status. The promo code field will be your primary key. This data extension should never be overwritten or purged. It must have a ‘Claimed’ or similar boolean field that will flip to True as each code is claimed by the AMPscript while logging the code claim date/time and the associated SubscriberKey. This is the data extension that the AMPscript will both pull from and update to.

The second data extension will hold only those codes that are unclaimed/active. This data extension is not critical for sending promo codes, but it allows us to trigger automated alerts when the volume of active codes drops below a certain threshold.

The first data extension would be populated by two sources:

  • Import automation that’s triggered by your promo code file. This could be as simple as a single-field PromoCode add-only import.
  • The claimrow AMPscript will update each PromoCode row as codes are claimed. This ensures that we don’t send the same code to multiple recipients while also allowing us to lookup an individual’s existing assigned code for use in reminder emails – rather than sending them a new code each time.

The second data extension is populated by a query. A simple query, pulling all records from the PromoCode DE where ‘Claimed’ does not equal True, as we want a count of all active codes.

The next step in this automation is a verification step, set to send an alert to the individual who manages the codes. For example, sending an email alert that the count of active codes has dropped below 15,000.

The last piece of the puzzle is the AMPscript. As mentioned above, this code does more heavy-lifting than simply pulling a value from a data extension field.

Here’s an example of how this might look:

					console.log( %%[
Set @subkey = _subscriberkey
/* Check if this is a preview rendering */
if _messagecontext == "PREVIEW" then
    set @PromoCode = "TESTCODE"
    /* Check if this subscriber already has a code assigned for this campaign */
    SET @PromoCode = Lookup("ExampleCampaignPromoCodesDE","PromoCode","SubscriberKey", @subkey)
        IF Empty(@PromoCode) THEN
            /* Subscriber does not already have a code assigned so we claim one */
            set @PromoRow = ClaimRow("ExampleCampaignPromoCodesDE", "Claimed", "Subscriberkey",@subkey)
                if not empty(@PromoRow) then
                    set @PromoCode = Field(@PromoRow, "PromoCode")
                    /* No unclaimed codes exist so we log the error and stop the send */
                    InsertDE('ExampleCampaignPromo_RaisedErrorLog','SubscriberKey',_subscriberkey, 'Email',emailaddr, 'ErrorMessage','No promo code was located','EmailName',emailname_)
                    RaiseError('No promo code was located',false)
    /* This could pull expiration date if present */
    SET @ExpirationDate = Lookup("ExampleCampaignPromoCodesDE","ExpirationDate","Subscriberkey", @subkey)
Here is your promo code: %%=v(@PromoCode)=%%
It expires on %%=v(@ExpirationDate)=%%
'Code is Poetry' );

This process takes more time than hardcoding “WELCOME20” into your email and calling it a day. But it provides the benefits of serialized promo codes in email without many typical hurdles.

Want to take it a few steps further?

In the example above, we check if the ClaimRow function successfully retrieves a previously unclaimed row. We do this by ensuring that @PromoRow is not empty. In cases where @PromoRow is empty, we utilize the RaiseError ampscript function. This allows us to halt the entire deployment or skip the current subscriber. In this case, we have elected to halt the entire send. We are also logging the error to a data extension (‘ExampleCampaignPromo_RaisedErrorLog’).

Open tracking has always been tricky as it relies on a rendered tracking pixel and has become less reliable with recent privacy settings. An email open also doesn’t guarantee that the individual redeemed the code. However, if you can create an extract from your commerce platform of the redeemed codes, then a nightly refresh of your PromoCodes data extension could flip an IsRedeemed boolean for those records. You can use this data to either exit applicable records from the journey or skip any resend/reminder steps.

Speaking of opens, you may not want to chew through your promo codes when previewing your emails in Marketing Cloud. To prevent this, simply nest your claimrow ampscript inside an IF statement that checks whether the _messagecontext == “PREVIEW”, as seen in the example above.



Special thanks to Ben and Swati for sharing their tradecraft. Personalization is a hot topic in marketing, so we remain keen to share actionable advice and tips on getting the most out of it. You might therefore like to read our eBook, How Can You Improve Customer Experience With Personalized Data in Salesforce Marketing Cloud? 

We understand the commercial importance of data and marketing. So we wrote this eBook to ease the process of understanding personalization’s nuances and technicalities. The book provides actionable advice regarding the use of personalization by leveraging data. You can download it here.

Latest Articles

  • Unveiling New Reporting Features in DESelect Engage

    Webinar Transcript Time-Smart Marketing: Import Journey & Automate Retries with Engage Don’t miss the next one Read the release notes from this feature: here Written transcript from this webinar will be available soon. In the meantime, please watch a recording of the webinar on Youtube (above).     Don’t miss an update       […]
  • Harnessing the Power of Relative Dates in Salesforce Marketing Cloud (SFMC)

    The ability to adapt and react with timely precision is key in the marketing world. Marketing Cloud Engagement (MCE), also often referred to as Salesforce Marketing Cloud (SFMC), offers robust tools to facilitate such agility, particularly through the use of relative dates. This feature enables marketers and SFMC admins to automate campaigns with a precision […]
  • 14 Data & AI Challenges Collected from 57 Leaders in MOPs (Transcript)

    Webinar Transcript 14 Data & AI Challenges Collected from 57 Leaders in MOPs Don’t miss the next one Download the report mentioned in this webinar: here Anthony Lamot: Hello! And welcome to a brand new webinar by DESelect. I’m here today, joined by my co-founder, Jonathan, and I’m Anthony, and we are DESelect for Salesforce. […]
  • Kyra Constam, Creative & Web Manager

    Company Culture Meet Our Team: Creative & Web Manager, Kyra Constam In the dynamic world of design, Kyra Constam stands as a definition of talent and innovation. Get her take on her DESelect journey →   Her journey at DESelect began with the title of Senior Graphic Designer, where her talent and hard work shined […]

Stay Connected

Stay Connected

Reach the most targeted<br/> audiences in half the time

Reach the most targeted
audiences in half the time

Deselect icon
Subscribe to the Newsletter
Receive Salesforce Marketing Cloud tips,
tricks, and DESelect updates

By clicking the “Subscribe now” button, you agree to the DESelect Terms of Use and Privacy Policy.