Re: Can you segment tokens based on custom objects.

Anonymous
Not applicable

Can you segment tokens based on custom objects.

I want to be able to send subscribers a certain token based off of an action in their past history. Is anyone familiar with this?

9 REPLIES 9
SanfordWhiteman
Level 10 - Community Moderator

Re: Can you segment tokens based on custom objects.

You can segment based on CO presence/properties, yes. And you can also use Velocity to display conditional content based on COs. Not sure what you're specifically trying to do. More detail would help.

Anonymous
Not applicable

Re: Can you segment tokens based on custom objects.

Hi Sanford,

I actually need to rephrase my question. I created a custom object and a message body field which has HTML text in it. How can I add a token to my email that will pull the field of the custom object with the HTML?

SanfordWhiteman
Level 10 - Community Moderator

Re: Can you segment tokens based on custom objects.

I created a custom object and a message body field which has HTML text in it. How can I add a token to my email that will pull the field of the custom object with the HTML?

Use a Velocity ("Email Script") token: Velocity has access to your COs and their fields. They're presented as a (zero-indexed) array of objects (technically, Java ArrayList) when you drag them into the Script Editor.

You can see a bunch of my sample code if you search the Community.

Anonymous
Not applicable

Re: Can you segment tokens based on custom objects.

That's great Sanford. Last question here. Can the default value for a token be html code?

SanfordWhiteman
Level 10 - Community Moderator

Re: Can you segment tokens based on custom objects.

Yes, though when you're using Velocity you don't do {{my.token:default=<div></div>}}.  You output the default value from the Velocity script itself, i.e.

#if ( $somefield.isEmpty() )

<div>Default output</div>

#else

${somefield}

#end

Anonymous
Not applicable

Re: Can you segment tokens based on custom objects.

Hi Sanford, We ended up using the token in the html code of the email itself instead of using a velocity script. The issue with the velocity script, is that we have three div tables that we need to group together, versus one table by one table.

It looked like this:

{{my.token : default =

<div></div>

<div></div>

<div></div> }}

Although this worked, for some reason it is not tracking through the Marketo server. Our branding domain converts links to em.agingcare.com but in this particular instance the links did not convert once we began testing real sends.

Alternatively, I used a snippet and had my default value for the majority of the segment and just the token itself with no default value for the targeted segment. This seemed to work and did not have the above issue, but we really only wanted to put a token directly into the email body.

Do you have any insight on why this might be happening and what we can do to fix this?

SanfordWhiteman
Level 10 - Community Moderator

Re: Can you segment tokens based on custom objects.

Trackable links when emitted from Velocity need to follow certain formats. I've written a lot about such things on my blog (http://blog.teknkl.com/tag/velocity) and here on the Nation.

Anonymous
Not applicable

Re: Can you segment tokens based on custom objects.

Hi Sanford,

I want to clarify what were doing.

We have a block of HTML that contains links in a field and we are pulling that field into our email via a token. When we send the test the links are not converting to Marketo trackable links.

This is how we need it to render:

pastedImage_0.png

This is how it renders with the tokens:

pastedImage_1.png

SanfordWhiteman
Level 10 - Community Moderator

Re: Can you segment tokens based on custom objects.

You should probably read my posts on emitting multiple tracked links from Velocity. In general, if you're not very familiar with VTL you shouldn't have more than 1 link emitted from each token. When you have multiple links (as in your multiple Read More links) you need to use different Velocity $variables for each. It does all work but you need to dig in pretty deep.