Conditional Content by State Using S Tags

Options
Hello All!


I'm a new Luminate user and I'm curious if it's possible to use S-tags to personalize content in an email by state.


For instance, an audience member from NY would see NY content, and someone from DC would see DC content. Ideally this would cover all 50 states.


I tried nesting a bunch of conditional statements together like this...

[[? S1:home_stateprov]]::AL::T

:: Local Content AL ]]

:: [[? S1:home_stateprov]]::AK::T

:: Local Content AK ]]

:: [[? S1:home_stateprov]]::AZ::T

:: Local Content AZ ]]

... and did that 50+ times over, but that didn't work (probably because my syntax is way off).


Has anyone been able to do this before? Would love to get some advice from the pros!


Thank you!


Nathan

Tagged:

Comments

  • There is also a nesting limit for S-Tags. I think it's around 20. So you will need a couple of separately nested conditionals to cover the whole country.


    And since you are running through a big set of lookups, it makes sense to put them in a most-likely order for speed reasons. Here's three nested. You can go to 20ish before getting an error.


    [[?~[[S1:home_stateprov]]~::~CA~:: SHOW CA CONTENT::

    [[?~[[S1:home_stateprov]]~::~NY~:: SHOW NY CONTENT::

    [[?~[[S1:home_stateprov]]~::~IL~:: SHOW IL CONTENT::

      SHOW DEFAULT CONTENT OR NOTHING

    ]] ]] ]]


    [[?~[[S1:home_stateprov]]~::~FL~:: SHOW FL CONTENT::

    [[?~[[S1:home_stateprov]]~::~NC~:: SHOW NC CONTENT::

    [[?~[[S1:home_stateprov]]~::~OH~:: SHOW OH CONTENT::

      SHOW DEFAULT CONTENTOR NOTHING

    ]] ]] ]]


    S-Tags conditionals mean "If THIS contains THAT then SHOW THIS else SHOW THAT"


    The "contains" part is important and is the reason people wrap the values in * or ~ or whatever. 


    In this case, some Canadian provinces could contain US states in their name. So ALBERTA contains AL. But ~ALBERTA~ doesn't contain ~AL~. Make sense?


     
  • If this is a one-off thing, then all these conditionals make sense.


    But if this is an ongoing/recurring thing like a welcome series, you can make it easier using a different trick with naming conventions.


    Make a reusable page for the content for each state. Name them reuse_WelcomeSeries_AL, reuse_WelcomeSeries_CA, etc.


    Then in your email, all you need to do is...


    [[E51: reuse_WelcomeSeries_[[S1:home_stateprov]]]]


    S51 renders a reusable page, and E51 does the same, but it Evaluates the inner S-Tag first. The inner s-tag renders to AL, so in the end you get [[S51:reuse_WelcomeSeries_AL]] and the content for AL displays.


    Now you would be making a reusable pagebuilder page for each state, so that doesn't make sense for every email you do. But it could be better for an email that runs a lot and stays the same, like your welcome series.


    Works with stuff like images too.


    <img src="../stateFlag-[[S1:home_stateprov]].jpg" />


    The burden is on you to make all the required pages, of course. Miss one and they will just see a blank email! 


    BPM



    EDIT: Ooo, there's [[S151:pagename]] which checks if a page exists. That's a cool failsafe. Something like:


    [[? [[E151:[[E51: reuse_WelcomeSeries_[[S1:home_stateprov]]]]]]::TRUE::[[E51: reuse_WelcomeSeries_[[S1:home_stateprov]]]]::[[S51: reuse_WelcomeSeries_Default]]]]
  • Brian!


    This is such good information! Thank you so, so much for your incredibly speedy reply- and for answering questions I didn't even know I had yet!


    The case I'm working on would be sort of a one-off thing, so your first explanation is perfect for me; though it is very uplifting to know that the capability exists to do state personalization in recurring mailings (will pitch this!!!).


    Follow-up question for you, Brian:


    In regards to your first explanation, I'm thinking I would have five "buckets" of nested statements, each with 10 states.


    Is there a way for me to connect those buckets so that someone who doesn't fall into any of the buckets will see one set of default content? I definitely want there to be default content, but I'm concerned that if someone falls into the first bucket, they'll see the alt text for the other four.


    Would it make sense to nest those five buckets in another s-tag so they're all associated with each other?


    Thank you again for helping me out with this, Brian!


    Nathan
  • I think that any way to directly connect them would be nesting.


    One thing you could do is just use a task to segment your audience by your five regions.


    From there you could then have a separate email for each. That might be beneficial to you for regional comparisons on open rate, etc.



    Another option to do this in a single send (with one complete set of open rates, etc.) is to make 5 reusable pagebuilder pages, each with the relevant 10 nested conditionals.


    Then in your email add a conditional to load one of those reusables according to their segmentation.


    [[?~[[S45:1001]]~::~TRUE~:: [[S51:reus_regionOne]]::

    [[?~[[S45:1002]]~::~TRUE~:: [[S51:reus_regionTwo]]::

    [[?~[[S45:1003]]~::~TRUE~:: [[S51:reus_regionThree]]::

    [[?~[[S45:1004]]~::~TRUE~:: [[S51:reus_regionFour]]::

    [[?~[[S45:1005]]~::~TRUE~:: [[S51:reus_regionFive]]::

      [[S51:reus_regionDefault]]

    ]] ]] ]] ]] ]]


    I'm betting this won't be seen as nesting, even though there are really 10 conditionals in those PB pages.



    One last idea is to store the found state of the previous set of conditionals using a session variable. The docs say session variables don't work in email campaigns, but I have used them and they always seem to work for me. Worth a try. (This idea should be an option on a web page at least, )


    [[U0:StateFound=unknown]]

    [[?~[[S1:home_stateprov]]~::~CA~::SHOW CA CONTENT::

    [[?~[[S1:home_stateprov]]~::~NY~::SHOW NY CONTENT::

    [[?~[[S1:home_stateprov]]~::~IL~::SHOW IL CONTENT::

      [[U0:StateFound=false]]

    ]] ]] ]]


    [[?*[[S80:StateFound]]*::*false*::

    [[U0:StateFound=unknown]]

    [[?~[[S1:home_stateprov]]~::~FL~::SHOW FL CONTENT::

    [[?~[[S1:home_stateprov]]~::~NC~::SHOW NC CONTENT::

    [[?~[[S1:home_stateprov]]~::~OH~::SHOW OH CONTENT::

      [[U0:StateFound=false]]

    ]] ]] ]]

    :: <!-- Show Nothing - State Found Previously --> ]]


    [[?*[[S80:StateFound]]*::*false*::

    [[U0:StateFound=unknown]]

    [[?~[[S1:home_stateprov]]~::~FL~::SHOW IA CONTENT::

    [[?~[[S1:home_stateprov]]~::~NC~::SHOW ND CONTENT::

    [[?~[[S1:home_stateprov]]~::~OH~::SHOW WA CONTENT::

     SHOW DEFAULT CONTENT

    ]] ]] ]]

    :: SHOW DEFAULT CONTENT (Should never occur) ]]



    Post what you discover!



    BPM

Categories