I used the Dynamic Content code creator found under Marketing in the main menu to generate this:
[% if contact.tags.uids contains "640" %]
if clause
[% else %]
else clause
[% endif %]
I put this in a campaign email then sent a number of test emails to myself to see if it works. I cannot get it to run the if clause, only the else clause. The email I test at is a contact in InfusionSoft and does have the tag number 640 applied. I also tried contact.tags.titles with the title of the tag and it also didn’t work.
I assume I’m missing something. Maybe uids is not what I think it is.
I searched the help center and found “liquid syntax” which looks like the code that’s generated when you click “merge” in the toolbar. It’s very similar, and I’d be happy to use it, if I could find the documentation that lists all the functions/methods. The links to “documentation” on that help page are dead links.
Sending a test email that contains Liquid dynamic content from the campaign builder will not call the contact’s tags, apparently. If you are trying to test Liquid dynamic content you need to publish your testing in a dummy campaign sequence then manually place a test contact in the sequence. Using the test function in the campaign email editor will not always work.
I sent test emails from the campaign builder at first. The liquid code was able to successfully run [[ contact.first_name | downcase ]] and [[ contact.first_name | upcase ]], but fails to run [[ contact.tags.uids | comma_separated ]] or [[ contact.tags.titles | comma_separated ]].
When going to the contact and manually adding it to the campaign sequence, all the liquid dynamic content worked as expected. Here’s the full test code I ran with results written after //
First name to lower case: [[ contact.first_name | downcase ]] // successful on both
First name to upper case: [[ contact.first_name | upcase ]] // successful on both
Tag ids csv: [[ contact.tags.uids | comma_separated ]] // successful on manual campaign entry only
Tag names csv: [[ contact.tags.titles | comma_separated ]] // successful on manual campaign entry only
[% if contact.first_name contains "D" %] // successful on both
If first name contains "D"
[% elsif contact.first_name == "DVM" %] // first if was true, didn't run
If first name is "DVM"
[% else %] // first if was true, didn't run
else first name
[% endif %]
[% if contact.tags.titles contains "Free Account" %] // true, ran on manual campaign entry, but not test function in campaign builder
If tags titles contains Free Account
[% elsif contact.tags.titles contains "Pay Account" %] // true, but did not run on test function in campaign builder
If tag titles contains Pay Account
[% else %] // ran in test function in campaign builder, but should have run first if
else tag titles
[% endif %]
[% if contact.tags.uids contains "1256" %] // true, ran on manual campaign entry, but not test function in campaign builder
If contact tags contains 1256
[% elsif contact.tags.uids contains "1254" %] // true, ran on manual campaign entry, but not test function in campaign builder
If contact tags contains 1254
[% else %] // ran in test function in campaign builder, but should have run first if
else tag ids
[% endif %]