Re: [Templates] Conditional statements with tokens (if ... else ...)

Anonymous
Not applicable

[Templates] Conditional statements with tokens (if ... else ...)

In landing page template development, can we make use of conditional statements in combination with tokens (e.g. if {{Lead.Inferred Country}} is..., if {{Lead.Full Name}} contains...)?

Example 1: Some leads in our db have 'unknown' in the job title field. I wand to clean up our db but progressive profiling doesn't work here since there is a value. If I was able to show a particular form based on this value I could include a particular form that would ask just this without pre-populating the form so the user is forced to re-enter this data.

Example 2: A cool Marketo form feature is "If visitor known, show ...", but its powers are limited. We might have a form of 10 fields, but if for example we know the person's email address it would be considered a "known visitor" so he/she doesn't see the form. With conditional statements we could create this functionality ourselves and make it a bit more smart. A combination of progressive profiling,  "If visitor known, show ..." and conditional statements would allow us to clean our db and make the user experience much better (only ask what we really need).

Thanks!

4 REPLIES 4
Anonymous
Not applicable

Re: [Templates] Conditional statements with tokens (if ... else ...)

Jerry Reitveld

Segmentations and dynamic content allow you to present one LP to one section of leads, and another LP the a different section.

In order to do this, your segments need to be structured so that they only live in one section. You also want to be sure that you are creating a segmentation that will be used more than once, since it tends to slow down overall campaign queues.

Once you create a segmentation, you then can diversify any editable section in your LP, and add it to the Dynamic section:

pastedImage_0.png

This allows you to provide a different experience to each segment.

SanfordWhiteman
Level 10 - Community Moderator

Re: [Templates] Conditional statements with tokens (if ... else ...)

Jerry, any of those tokens can simply be output into a JavaScript block in your template.  Then a front-end developer (which can also be you!) can easily render alternate content based on those variables.

A very primitive example to get the point across:

<SCRIPT>

if ( "{{Lead.Full Name}}" != "Jerry" ) {

    JerryHTML.show();

}

</SCRIPT>

Anonymous
Not applicable

Re: [Templates] Conditional statements with tokens (if ... else ...)

Nice! do you know where we could look for more documentation on stuff like this?

SanfordWhiteman
Level 10 - Community Moderator

Re: [Templates] Conditional statements with tokens (if ... else ...)

You've got the whole world of JavaScript open to you when you export your tokens this way!*  So it's kind of hard to point a particular doc.  Are there some specific things you're interested in doing in the page?

* I'm using the programming definition of "export" -- taking a variable from one language/context and presenting it in another -- rather than "export" as in saving to an Excel file.