Overview


This page shows some common uses of Engage Dynamic Scripting, and how they can be used in an actual email. For more complex examples, including examples of all types of comparison functions, see Complex Email Scripting Examples (Conditionals).

 


Dynamic HTML Tags - Reminder


Remember that dynamic block statements should be surrounded by HTML <dynamic> tags:


<dynamic>


[content]


</dynamic>


This will prevent the HTML editor used for emails and templates from formatting the dynamic content as regular HTML content. Dynamic content blocks, therefore, only appear in the HTML source view of an email or in the editable section of an email Template.


Scripts will work and process without the <dynamic> tags, but they may display incorrectly in the WYSIWYG HTML editor.


Dear [name]/Dear Customer, or From [name]/From Your Account Representative


This is possibly the most common simple use of Dynamic Scripting in the body of an email. With one statement, you can call the first name, last name, or concatenated first and last name into the email. But there is the possibility that not all customer accounts will have names attached to them. In those cases, you may want to have the email refer to them as "Customer" rather than just a blank. The following script would do just that. Note that the first statement checks whether or not subscriber.firstname is blank.


Dear


<dynamic>


|*if subscriber.firstname <> ""*|


|*subscriber.firstname*|


|*else*|


Customer


|*endif*|


</dynamic>


 


You could use this same conditional format with a custom attribute representing an account manager name to add the name or a generic placeholder to a message:


A message from


<dynamic>


|*if subscriber.attributes.accountmgrname <> ""*|


|*subscriber.attributes.accountmgrname*|


|*else*|


your account manager


|*endif*|


</dynamic>


 


Non-Blank Strings


The general syntax of comparing an Attribute to a string is also often used in blocks to display specific text and images based on the value of a variable, rather comparing to a blank.


This is often used to check for a Subscriber Attribute value shared by many subscribers at once, such as an Account Manager name. For this example, you'd build the dynamic script as follows:


|*if subscriber.attributes.accountmgrname == "Jane Smith"*|


Your account manager, Jane Smith


|*else*|


Your Questline account manager


|*endif*|


NOTE: In cases like this where you are comparing to a non-blank string, you still need double quotes around the string. Additionally, the string itself - and therefore the values in the subscriber attribute you are comparing to - cannot include double quotes.


 


A Message From [company name], Regarding [topic]


You may have several sub-companies under your account - Regional Operating Companies, for example. In such cases, it may be that you have a customer attribute column called subscriber.attributes.companyname. You may have a related webpage for that specific company that you store as a dynamic scripting variable at subscriber.attributes.companyurl.


Your campaign may have a unique name that makes sense to display, in which case you could create a customer subscriber attribute such as |*subscriber.attributes.campaign*|.


You could then use these variables to add text into an email stating something like:


"This is a message from |*subscriber.attributes.companyname*| regarding |*subscriber.attributes.campaign*|. For more information, visit us at |*subscriber.attributes.companyurl*|.


As with the previous example, if there's no value for these variables for an individual subscriber, nothing will display, so unless you are sure that all subscribers have values for your custom columns, you may wish to build a conditional as in the Dear Customer example above.


Contact us at [reply to address]


While a reply to address is automatically put in the header of the email based on the Sender Profile, you may want to add it to the body of an email as well. This is as easy as using the Insert Dynamic Content function to choose Message Attributes > Reply To Address or typing |*message.replytoaddress*| in the HTML of an email.