Skip to main content
All CollectionsSalesforce Marketing CloudSFMC - Triggered Email Message Experiments
SFMC - Triggered - In-Body Multiline Language Optimisation
SFMC - Triggered - In-Body Multiline Language Optimisation

How to alter the Jacquard triggered experiment code snippet for multiline in-body optimisation

Updated over a week ago

This feature requires special provisioning and a custom language model. It is not available with Jacquard's standard triggered experiment offerings. Please let your Customer Success representative know if you are interested in this use case.

Optimising content in the body of an email with Salesforce Marketing Cloud (SFMC) requires a slightly different application of our triggered experiment technology, particularly when that content features multiple lines that must be styled differently.

As you may know already from reading about our Salesforce Marketing Cloud triggered message experiment solution, Jacquard pushes a code snippet into your instance of Salesforce when an experiment is provisioned. The code snippet is for you include in the body of your email.

However, the code snippet as it is configured by Jacquard treats the variant as one piece, regardless of how many lines it contains.

If your language model has been custom configured to generate multiple lines of copy per language variant, you may want to style those lines differently.

No biggie! We'll show you here how to manually update the code snippet once it's in your Salesforce Marketing Cloud instance so you can style those lines one at a time.

We'll start with identifying the piece of code you need to change. Then, we'll go over what to paste in its place, how to modify what you've pasted to suit your experiment and how to place your new variables in your email body.

This article assumes your language variants will have three lines: headline, subhead and CTA. However, this same principle could be applied to just two lines styled differently as well.

Identifying the code snippet

The code snippet is named from the experiment you created in Jacquard.

For this example, our experiment in Jacquard is creatively named SFMC_Multiline_In-Body_Experiment. Thus, our code snippet is automatically named SFMC_Multiline_In-Body_Experiment_CS.

Begin by opening the email you'll be optimising and locating your code snippet. Then, drag your code snippet into the body of your email.

You'll want to place the code snippet in the email above where the actual content needs to display.

Pasting the custom multiline code

Now, click on the code snippet in the email to open it in the editor.

Scroll down in the editor until you reach the following lines of code (usually it's around line 66):

Variable.SetValue("@phraseeVariantText", phraseeVars[0]);

Highlight this piece of code and the subsequent lines through the line beginning with Variable.SetValue("@phraseeVariantText", as shown below:

Paste the following over the lines you've highlighted:

          Variable.SetValue("@phraseeVariantText", phraseeVars[0]);
Variable.SetValue("@statisticsUrl", phraseeVars[1]);
var slHb = phraseeVars[0].split('\u303D');
var phraseeHeadline = slHb[0] || '';
var phraseeSubhead = slHb[1] || '';
var phraseeCta = slHb[2] || '';
Variable.SetValue('@phraseeVariantHeadline', phraseeHeadline);
Variable.SetValue('@phraseeVariantSubhead', phraseeSubhead);
Variable.SetValue('@phraseeVariantCta', phraseeCta);
}
} finally {
var currentVariantText = Variable.GetValue("@phraseeVariantText");
if (!currentVariantText) {
var batchId = "0";
var sendId = Platform.Function.GUID();
Variable.SetValue("@phraseeVariantHeadline", "YOUR HEADLINE");
Variable.SetValue("@phraseeVariantSubhead", "YOUR SUBHEAD");
Variable.SetValue("@phraseeVariantCta", "YOUR CTA");

What we've just done is replace two key sections of the code.

The first section we replaced previously brought in all three lines of your language variant as one string. Instead, the code we've now added will call the variant and divide it into three, giving each line of language its own variable.

The second section we replaced previously included your entire human control variant as a fallback. We've now changed it to instead include three different fallbacks, one for each individual line of your human control.

Modifying the code

As we just mentioned, the latter part of what you just pasted is a fallback to populate your human control line in the event one of your lines doesn't render correctly. In order to do that and still have your individual styling function, you'll need to paste in each human control component individually in the right place.

You should paste your human control headline over the YOUR HEADLINE placeholder in the code. Similarly, paste your human control subheader line over the YOUR SUBHEAD placeholder. Do the same for your CTA over the YOUR CTA placeholder.

Remember to leave the apostrophes intact. Only replace the placeholder letters.

When you're satisfied with your code, click Done Editing and Save your email.

Placing your three variables

Now that you've edited the code block, you are able to place the following variables in the body of your email and style them as you see fit:

%%=v(@phraseeVariantHeadline)=%%

%%=v(@phraseeVariantSubhead)=%%

%%=v(@phraseeVariantCta)=%%

Once you've placed your variables, make sure you test your email thoroughly before deploying it to any live subscribers.

If you notice an issue when testing, you can always re-drag your code snippet back into the body of your email and start this process over. By dragging the block into the email before editing, we've left the original block intact in case you need to begin again.

Did this answer your question?