0

The AMPscript is set up like this in Content Builder. Example:

Content Block 1
SET @linkButton = "link1.com"

Content Block 2
SET @linkButton = "link2.com"

Content Block 3
SET @linkButton = "link3.com"

In the plain text only, "link3.com" is displayed for every @linkButton instance since that was the last link assigned to the @linkButton variable. Are there any workarounds for this without assigning a unique variable name to each link?

1 Answer 1

0

Obvious stuff first:

Email code including AMPScript is interpreted top to bottom. So at the end of your code, the last variable assignment is the result.

Plain text is interpreted after HTML. The "top to bottom" rule thus is valid across the different elements:

AMPscript processes functions in this order:

  • HTML Body
  • Text Body
  • Subject Line
  • Any preheader values reside at the beginning of the body and process accordingly.

https://developer.salesforce.com/docs/marketing/marketing-cloud/guide/orderOfOperations.html

The default behavior is that the plain text version is auto-generated. This auto-generated version repeats every bit of code from HTML, including AMPScript, which would prevent your problem (but can create others) as the vars would be reassigned in plain text again.

So normally, plain text is copy of HTML.

html:

enter image description here

If you now switch to plain text, and once you start manually editing the plain text version to differ from the HTML (ask yourself why), this message appears when you start:

enter image description here

...only then can you start writing your plain text version.

plain:

enter image description here

From that point on, the system doesn't copy anything you do in HTML into plain text, and you have to set your variables again in the plain text, or the last variable assignment from HTML stays throughout the entire plain text version - which is what you observed. All links were the last variable from HTML.

Solution:

So - 99% of usecases, you want to just "restore text from HTML" in the plain text version and never think about it again.

after pressing "restore" you can see that AMPScript is automatically replicated with the html content in plain text version, so that your problem would not occur because the var assignment is repeated:

enter image description here

...and you are back at the default behavior again.

===

IF you really really are in the 1% of usecases that truly need different HTML and plain text versions - think again about how important your special text version is - THEN you have to manually replicate the AMPscript in your altered plain text version and maintain all AMPscript twice.

to be clear: Including some (any) text version is good practice for e.g. deliverability. So definitely include one. But having a manually crafted, custom tailored text version is in my experience almost never worth the effort.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .