Skip navigation
All Places > Marketo Whisperer: Implementation Tips > 2015 > July

I started using some email scripts about a year ago when our support for Velocity scripting was pretty new. As has no doubt become obvious by now, I’m not the most technical of consultants. (That’s why John’s on this blog.) In teaching myself how to do this, all I had to go off of was the documentation on the developer site (here), the Apache documentation (here), and trial and error.


Sadly, published examples of working email scripts for Marketo are still few and far between. So, while I cannot explain much about Velocity from the technical side, I can share some very basic email scripts that even a marketer like me can use.


If you don’t know how to properly create an email script token, you should refer to the doc here.


Example 1: Properly Capitalizing First Name

#set ($fname = ${lead.FirstName})







Example 2: Displaying a Greeting Based on Gender (Portuguese)

#if ( ${lead.gender} == "F" )

Cara Sra. Dra.


Caro Sr. Dr.



Example 3: Displaying a Greeting Based on Gender (German)

#if ( ${lead.Salutation} == "Mr." || ${lead.Salutation} == "Mr" )


#elseif ( ${lead.Salutation} == "Mrs." || ${lead.Salutation} == "Mrs" || ${lead.Salutation} == "Ms." || ${lead.Salutation} =="Ms" || ${lead.Salutation} == "Miss" )






Example 4: Displaying a Table with One Row for Each Sales Order for that Contact

<table border="1">


<th>Item <th>Order ID</th><th>Date</th><th>Price</th>


#foreach ( $SalesOrder in $SalesOrderList )
















Example 5: Displaying Different Email Text in an Email Based on a Lead Field Value

#if(${lead.fieldname} == "fieldvalue1")

Email text here

#elseif (${lead.fieldname} == "fieldvalue2")

Email text here


Email text here


This blog is the second in a multi-part series on monitoring your email deliverability. The first part on managing bounces can be found here.


While it’s very important to manage your bounces, it’s somewhat reactive in that you’re only addressing an issue after it’s already happened. It’s also important to be proactive and purge unengaged users from your mailing lists regularly. Many marketers are hesitant to do this because it means they will have a smaller target list. To be sure, new name acquisition is a key metric for a demand gen marketer, but since 25% of the average email list expires every year, we should be expecting that kind of turnover on our lists. Unless your unsubscribe and bounce rates for the year add up to 25%, which would be rare, that means you have to be taking an active role in purging.


You want to start with identifying your chronic non-responders. Look for people who have been delivered email in the last six, nine, or twelve months, but have not opened or clicked on any of them. If you don’t want to judge solely based on email behavior, you could also choose to look for other types of engagement, such as web page visits, form fills, or event attendance.


These individuals are a good target for a re-engagement campaign. Since they are already non-responsive, they are an easy group to test on. You basically have nothing to lose. You can do something as simple as a one-time email or do a more involved multi-channel nurture program. There’s lots of ideas for re-engagement campaigns on the Community, so I won’t spend too much time on that here.


But even if your re-engagement program is really successful, you are still going to have a lot of inactive leads left. As much as it might hurt to cut back your count of emailable leads, you should really marketing suspend these individuals. Why marketing suspend them? This means they will stop receiving promotional emails, but they will still have the ability to get operational emails, such as auto-responders if they fill out forms on your website. If you do see sudden activity from that person, you can then unsuspend them so they start getting marketing messages again.


The smart list will vary based on your requirements but will look something like this:

The flow can include just the Marketing Suspended change, but I like to add a custom reason field so that if I ever need to know why someone was suspended (or when), I have that recorded:

One side effect of regularly purging these people from your email lists is that you will see a corresponding improvement in your open and click-through rates from the remaining responsive leads, which will impress those you work with.

For global companies using Marketo, we often want to display information sometimes in the native language and sometimes in a standard language (such as English). A very common example is a form on your website. On the Portuguese website, you may wish to show the Country field labeled as País with the Portuguese values in the dropdown (Brasil, Estados Unidos, etc.) However, a corporate marketer may not be familiar enough with the language to know that Estados Unidos means United States. If they pull a smart list in Marketo to find all of the individuals with a Country value of United States, they may miss this variation and thus miss a large number of leads that should be included in the marketing campaign.


There are several common approaches to deal with this problem:


Approach 1: Display Native Language Value but Write English to the Database

On a form, we can display a value in the picklist to the website visitor, but write a different value into the database.

If we go in to the form field to edit the values, you can add the Display Value and the Stored Value separately, either by typing them into the Simple Editor one at a time or by pasting/editing them in bulk in the Advanced Editor, separated by a |.

The form will display to the user with only the Portuguese values:

However, in the database, they will be stored in English (BRAZIL or United States), depending on the option chosen by the website visitor. When the user revisits the form, it will still show the field value in the native language.


The upside to this is that everything is maintained in one field in Marketo and CRM, but the back-end users are able to do everything in one standardized language, regardless of which form the individual originally filled out.


Approach 2: Create Separate English Field in Marketo Only

Sometimes Approach 1 is not preferred because the CRM users are not comfortable with English and they would prefer to work with the native language. This is not usually a major issue with European countries, but is more common with Latin America and Asia.


If making changes to CRM is not possible for some reason, we can create a Marketo-only custom field and create data management campaigns that store an English value for all variations in a separate field. This ensures that the field used in CRM and on the form fields always maintains the native language for the website visitor and the CRM user. However, the marketer in Marketo can still find a standardized English version and they do not need to remember the native language variation of the country name.


So, let’s imagine a form where we display the country for Japan in the native language as日本. The marketer will not know this means Japan if they just look at the Country field. So, instead we build a list of accepted variations and set up a smart campaign to look at the Country field and populate the English version into a custom field.

Note: You can use choices to manage multiple countries in a single flow action, but we would recommend no more than 25 at a time.


This campaign can then be set up to run regularly and the marketer can pull a smart list using the mkto Country – English field to ensure that they always have a complete list of people in Japan, even if they originally populated their country on the English .com site.


Approach 3: Create Separate English Field in CRM

If making changes in CRM is possible and the users may have a need to see the English version in CRM as well as in Marketo, you may want to create the custom field in CRM directly and keep this in sync between both systems.

John M

Custom Activities in Marketo

Posted by John M Employee Jul 20, 2015


One of the more recently introduced features in Marketo is Custom Activities. We all know about the built in Activities Marketo provides out of the box, and you can see that list using the Get Activity Types REST API Endpoint, but what's a "custom" activity?


Well essentially it's analogous to a built in activity in structure and purpose in every way, only you define it as an action a user has taken that is relevant to your business, and you add those activities through a special REST API Endpoint. Just like Marketo activities, you get a Filter and Trigger associated with the new custom activity that you can use in your smart lists


Custom activities are currently a beta feature in Marketo, but are currently in production with a fair few clients. They must actually be created in your instance by consulting or support, so once you define their attributes, you can work with professional services or support to get the activities themselves created. Once that's done, you can use the API to populate them.


Defining A Custom Activity

The following aspects of a custom activity must be defined to create it in Marketo.

- Name : The name of the custom activity (that one's a bit obvious)

- Description (Optional) :

- Trigger Name : This is the name Marketo will give to the Trigger associated with this custom activity

- Filter Name : This is the name Marketo will give to the Filter associated with this custom activity

- Attributes : This is the list of all the relevant attributes on the activity. The possible datatypes are the usual suspects.. integer, float, string, boolean, and datetime

Screen Shot 2015-07-20 at 7.15.09 AM.png



The example I've chosen is "Purchase Product". When a Lead purchases a product, you might want to send a welcome email, or add that lead to  nurture stream. When passing on your request, you should have these ready to give to support or consulting in a concise format to avoid confusion. Note that you do NOT need a "purchaseDate" attribute, as Marketo give you a "date of activity" attribute for free.


- Name : Purchase Product

- Description (Optional) : a lead purchases a product!

- Trigger Name : Purchases Product

- Filter Name : Has Purchased Product

- Attributes :

     productID: string

     productName: string

     productDescription: string


Once the object is created, support will supply an Activity ID to you, which you'll use in your REST API calls to add activities. Be sure to make a note of it! In my case, that ID is 100006.


Let's take a look! The following screenshot shows the Trigger and two Filters that are created for you, and notice that your custom activity attributes are available as constraints. Cool right?!?! Think of all the cool possibilities. One thing that comes to mind is the creation of an activity like "Custom Form Fill". If you're using the SOAP or REST API to handle form fills in a custom way rather than using Marketo Forms, you don't get a "form fill" event.. but now you can emulate that with a custom Activity!


Screen Shot 2015-07-20 at 7.31.07 AM.png

Adding Activities

Now that you have your shiny new activity, lets add some using the REST API. For this example, I use Postman, and I really recommend it. It simplifies the process of interacting with the REST API. Note if you arent comfortable creating timestamps, there is help available! Check out sites like the Timestamp Generator / Converter -


Screen Shot 2015-07-20 at 8.38.14 AM.png


Request (note that you can send in many activities in one request)










                "name": "productName",

                "value": "iPhone"



                "name": "productDescription",

                "value": "iPhone 6s+"











                "name": "productName",

                "value": "Apple Watch"



                "name": "productDescription",

                "value": "Apple Watch Edition"








  "requestId": "94a2#14eac235e1a",

  "result": [


      "id": 76356,

      "status": "added"



      "id": 76357,

      "status": "added"



  "success": true



Viewing Activities

Just like normal activities you can view these in campaign result, and also in lead details under the activity tab.


Screen Shot 2015-07-20 at 8.47.13 AM.png


Limitations and Considerations

- The volume limit for these activities is a bit fluid, but we recommend keeping under 100,000 per day. That limit can be revisited depending on usage.

- Custom Activities cannot be used in email scripting. Think of them like normal activities.

Having a clean list is essential to maintaining good email deliverability. Marketo does some, but not all, of the work for you. This blog will be the first in a multi-part series on monitoring your email deliverability.


First up, identifying unsuccessful email addresses. Many people think that Marketo stops emailing anyone who bounces but that is not true. We stop emailing anyone who bounces because of a bad email address, but that’s not the only reason a mail server would give us a bounce. Think of a hard bounce as the recipient going “nope, never going to receive that email, no matter how many times you ask me” and a soft bounce as “well, maybe later but not right now”. Bounces fall into three main categories:

  • Incorrect email address
  • Anti-spam block
  • Technical issues
  • Soft bounces


Let’s take a quick look at what happens in Marketo for each of these categories.


Incorrect email address

If the email address does not exist, it is a Hard Bounce and the email will be marked as invalid. The Lead record contains a field called “Email Invalid” which will be set to “true”. Also, the field “Email Invalid Reason” will contains the reason, if provided by the receiving mail server. This is the only type of Hard Bounce for which the Email Invalid field will be set to “true”.


The easiest way to see a list of this type of Hard Bounces is to look at the System Smart List “Bounced Email Addresses”. You can also create a Smart List with the filter “Email Invalid = true” and add a filter “Email Bounced” to specify the email for which it bounced (optional). Make sure you add the column “Email Invalid Cause”, so you can analyze the bounce reason.


Anti-spam block

If the receiving email server classifies your email as spam, it will also give a Hard Bounce. Marketo will stop trying to deliver this message and it will suspend all emails to that email address for 24 hours. This is done to protect your email reputation. After 24 hours, you can again send email to this email address. Marketo will record the cause of the suspend  in the field “Email Suspended Cause” and the suspend date in the field “Email Suspended At”. The field Email Suspended will be set to True temporarily.


To see a list of Blocks, create a Smart List that contains “Email Suspended Cause = not empty” and add a filter “Email Bounced” to specify the email for which it bounced (optional). Make sure you add the columns “Email Suspended Cause” and “Email Suspended At”, so you can analyze the bounce reasons.


Technical issues

If Marketo receives another error code or does not receive a response at all, there is usually a technical issue somewhere along the path from sender to recipient. This is classified as a Technical Bounce. Because this error is not caused by an anti-spam block or a bad email address, it is possible to immediately send other emails to this same email address. Also, neither “Email Suspended” nor “Email Invalid” is checked. This type of error is usually only a small percentage of an email campaign and it’s not something that you can take action on, because it’s a third party technical error. Usually the issue is resolved by the next time the lead is scheduled to receive email.


To see a list of Technical Bounces, create a Smart List with filters “Email Suspended Cause = empty”, “Email Invalid = FALSE” and a third filter “Email Bounced” in which you specify the email.


Soft bounces

When the receiving email server can temporarily not deliver a message, it tells Marketo to try again later. Marketo will try to redeliver the message several times for a period of time.  During that time it is shown as Pending in the Email Performance Report. When the message is still not accepted after 24-36 hours, Marketo will stop trying and report the message as a Soft Bounce. Since there is nothing you – as a sender – can do about temporary issues on the side of the receiving email server, there is nothing you can do to reduce the number soft bounces.


If you want to see a list of email addresses that soft-bounced, create a Smart List with the filter “Email Bounced Soft” and specify the email it bounced from (or choose “any” in case you want to see all bounces).


What should I do about them?

If we’re seeing repeated bounces due to technical or spam reasons to the same email address, you may want to mark these leads as Email Invalid and stop emailing them. If there are recurring failures over time, it is likely that email will never deliver to those addresses. Mailing to these can be risky because domains that have expired are sometimes turned into spam traps.


Here’s an example of a smart list that you could use to identify email addresses that are bouncing repeatedly (note the advanced filters):

(If you are emailing at least once a month, we suggest looking at a three month timeframe.)


On my team, we set up campaigns to marketing suspend leads that repeatedly bounce, with a custom reason field to keep track of whether it was because of hard or soft bounces. It is important to be proactive about dealing with these records, particularly when you are on a shared IP address with other clients. I personally like to set and forget on this kind of data management campaign, but you could also take a more proactive approach and review your chronically bouncing email addresses once a month and deal with them differently based on the reasons/frequency of the bounces. Just as long as you’re doing something about it!


Traditionally, most marketing resources (and many of our conversations about using Marketo) have been focused on the lead generation phase of the customer lifecycle. We don’t always spend much time on upsell, cross-sell, customer satisfaction, and advocacy. Gartner Group, however, estimates that 80% of a company’s future profits will come from just 20% of existing customers.


Given those statistics, as marketers we need to make sure that we’re putting an adequate amount of effort into:

  • Improving overall retention and upsell rates
  • Reducing the manual effort required to upsell and retain existing customers
  • Maintaining and growing customer references


What are some of the ways you can focus on your customers within Marketo?


First and foremost, if my workshops with my clients are any guide, a shocking number of us must admit that we don’t know who our customers are. The data that tells us someone is a customer frequently lives in another system that’s not connected to Marketo or it requires a combination of information from multiple systems so we don’t exert the effort to integrate that. As a customer, imagine how frustrating this is: “Stop emailing me with offers to join. I’m already a customer!” So, the first step is to agree on some rules about how to identify who is actually a customer and get your data in order so you have everything you need to execute those rules.


If you know who your customers are, you’re ahead of many. Now you have to decide what to do with that information. Again, think about what you like as a customer – to feel like the company cares about your business. You don’t want your customers to say: “The only time I hear from you is when you want me to renew and pay you more money.”


Consider a couple of these ideas:

  • Set up an onboarding/welcome nurture program for new customers
  • Set up an upsell/cross-sell nurture to existing customers to encourage them to buy relevant products/services similar to those they already own/use and to provide them with useful information about how to get more out of the stuff they already have
  • Set up a renewal/retention program with reminders and thank you emails
  • Set up a new scoring model just for customers to help track engagement and predict renewal/upsell
  • Set up a domain/account scoring process to identify new leads that come in and are associated with existing customer accounts so you are messaging properly to them right off the bat
  • Set up a customer reference/advocacy program – even with something as simple as the referral offers from the social tools
  • Extend your acquisition model or build a new customer model to track and report on customer onboarding, upsell, cross-sell, and renewal


It’s always really refreshing to see people putting some thought into managing the customer experience, not just the prospect lifecycle. If you have other ideas or want to share how you’re using Marketo for your customer lifecycle, please share!


               If choosing which Marketo Automation platform is not overwhelming enough, choosing which Pilot Program(s) you will launch first can definitely push you over the edge. Often times customers get tunnel vision on ensuring their instance is setup perfectly with appropriate tags, channels, LaunchPoint integrations, and a clean CRM sync. This can lead to them forgetting how to fully evaluate all the choices they made during their implementation.


                It’s a difficult pill to swallow telling customers they may not be able to fully report on any results until six months to one year after install. One way to expedite this timeline and see results much sooner is selecting a strong barrage of Pilot Programs. The selection of your Pilot Programs not only needs to be across multiple program types (e.g. Nurture, Email Send, and Event) but also across different customer schemas.


                Utilizing different Program Types will help flag any gaps in tags, channels, or naming conventions. It also helps the Marketo users to be more familiar with the many different ways Marketo can track and communicate with leads. Different customer schemas react different to nurture content, event invitations, or time-sensitive material. Marketo is great at personally reaching out to each lead in a channel that best suits them.


I suggest starting out with three Pilot Programs which we will review below:


Email Send -

An Email Send Program Type is a great first step at generating leads by sending a batch email in hopes of capturing activity for potential customers. I suggest to using an Email Send to prospects to create an interaction benchmark for non-customers. It has a great reporting interface built right into the program allowing the user to see results immediately after he or she sends out the first communication.


Engagement Program –

                A Nurture Program is more complex but once setup can continually nurture your leads from prospect to customer for an indefinite amount of time with little to no user involvement. I suggest setting up one generic stream sending out general, soft-touch product related content. In addition to the one generic stream, set up a stream for each product family your company offers. When a lead clicks on a product-specific link, move the lead to the appropriate product stream. When they have exhausted the product stream’s content, cycle them back to stream 1. They will automatically resume back to their previous position the stream before the move.


You should leverage content programs within each stream. Having content programs instead of an email directly within a stream will allow Opportunity attribution down to the email asset level (e.g. showing you ROI at the individual email level).


Here’s a diagram illustrating an example Prospecting Nurture program:


Nurture Diagram.png



Event Program-

                One of the most successful programs for attribution is the Event Program. If your company uses WebEx or GoToWebinar, I suggest integrating with Marketo for an easy membership list transfer. Whether the event be a tradeshow, roadshow, webinar, or customer dinner—ensure you have statuses and the appropriate smart campaigns setup to track them through the different stages. Too many times customers just upload the final attendee list with a success status directly into the Program instead of uploading the list of invitees and updating accordingly.


                If you have access to the overall Tradeshow attendee list, load it into the program and set the Acquisition Program to help with tracking and reporting (remember, for Opportunity attribution to a Program you need either a Program Success or Acquisition Program).


                I recommend using these three program types across prospects (Email Send), customers (Email Send or Nurture), and partner (Event) schemas. If you don’t have those different schemas, still feel free to mix it up across different categories of leads to gather benchmark data.


Don’t forget to check the Program > Setup tab to populate Program Cost and ensure all available tags are selected. Also make sure you have smart campaigns updating the appropriate statuses for click, unsubscribed, invited, etc.

“Why does my smart list count not match the Email Performance Report?” If there was a ranking for questions we hear most frequently, this would surely be near the top. I imagine the support team must answer this one all of the time.


Let’s take a look at why these don’t match up.



First of all, hopefully you know by now that opens is an absolutely awful metric to rely on. They depend on someone loading a small pixel in the email. If they have images blocked or if they read the email in a preview pane, we won’t be able to track that as an open. That’s a problem universal to all email senders.


Now, imagine that this person who has images blocked clicked on the email. Logic would dictate to us that they must have opened the email also. Our Email Performance Report has this logic built in. The activity log does not. So there will be no Opened Email activity recorded in the person’s activity log, but the report will count them as having opened. Bam, instant mismatch in counts.



But surely delivered is a reliable metric to look at in a smart list? Eh, not so much. Certain categories of soft and hard bounces only register after the delivered message. In this case, the activity log will show a Delivered activity followed by a Bounced activity. The report will register the person as delivered, but as soon as we get a bounced message, it will no longer count that email as having been delivered. This means your delivered numbers in your report could actually decline over time as we get more accurate information back from the email client.


The Basic Rules for Email Performance Report

  • Each email activity can be one and only one status: delivered, hard bounced, soft bounced, or pending.
  • If the email was opened, it counts as delivered.
  • If the email was clicked or unsubscribed, it counts as delivered and opened.
  • If the email was opened, we ignore bounce messages. If it was not opened, hard bounced wins out over soft bounced and delivered.


Deleted Leads

One final example. If you run a smart list for Opened Email, it would only show you a count for records that were in your database at that time. If you had previously deleted a record that had opened the email, the smart list would no longer count them. The email report, however, would still include that open in your count.


Moral of this story?

Your most accurate metrics are going to come from the email performance report.


John M

Sending an SMS using Twilio

Posted by John M Employee Jul 8, 2015

Webhooks are a great way for Marketo to interact with external systems and interfaces.  Common use cases include leveraging 3rd party interfaces for de duplication, to enrich lead data, and to send SMS messages. Here's an example of doing the latter leveraging Twilio, a Launchpoint partner of Marketo. The documentation for sending SMS messages for Twilio is also available.


Side note: Launchpoint is a thriving ecosystem of corporate partners that are actively developing solutions that complement the Marketo Platform. It's worth a look!


First...sign up for a Twilio account, taking note of your authentication token, you'll need that for sending your SMS.

Next up, create your webhook. Head over to Admin --> Integration --> Webhooks and click "new"




Webhook Name: Twilio Webhook

Description: Send an SMS

URL: (note you'll have to replace "Account SID" and "AuthToken" with the values from your Twilio Account

Request Type: POST

Template: From=%Your Send Number%&To={{lead.Mobile Phone Number}}&Body={{lead.Twilio Message:default=Test Message}}

Request Token Encoding: jSON

Response Type: None



     You'll need to put in your own Account SID and Auth Token

     You'll need to procure a Twilio Phone number to send from

     I also added a response mapping, as you can see of the "error_code" into the "twilioError" (API name) field. More on this later.


Once you have your Webhook set up, you have access and use it in your campaigns! In my example, I've set up a simple form on a Marketo Landing Page (both responsive and standard) that accepts First Name, Last Name, Email, Mobile Phone Number, and asks for a Message (limited to 255 characters). The lead is submitted to Marketo, the following data is updated or inserted


First Name

Last Name

Email Address

Mobile Number

SMS Message - a new string custom field on the Marketo Lead called "Twilio Message"

Error - a new string custom field on the Marketo Lead called Twilio Error


The Form and the Marketo Landing Page

I created a simple Form soliciting the above information (except Twilio Error, obviously), all of which are required, and put that form on a landing page. It looks like this:



The Campaign

Then we can create a simple campaign that is triggered off of the form being submitted, and then simply calls the webhook.


The Campaign Smart List



The Campaign Flow:



Once you've got all of that in place, submit the form, and youll see that SMS come through.





You can verify the SMS was sent in two places

1. The results tab of the campaign



2. The Lead Details Activity Tab



Bonus round

Sometimes the SMS may fail, and you may want to monitor for that. To do that, You can create a simple campaign trigging off the value changed of the "Twilio Error" field where the new value is not null. For the flow step, you can send an alert anywhere you like.. to an admin a distribution list.. wherever.


Cool, right?

Earlier this year, one of our technical consultants asked me to include the program ID in the program naming convention for one of our clients. We needed to be able to extract this from the program name for something they were doing with the API, in order to minimize API calls. I thought this was kind of silly and a bit of a pain, since we don’t know the program ID until after we’ve already named the program, so I’d have to go back and edit each program name every time. But, I agreed to do it because there was a really good reason for the tech team to have that, even though it was not useful for the operations team.


Boy, was I wrong. Having the program ID in the naming convention has been so much more helpful than I had imagined. It’s completely worth the extra few seconds to edit the program name after the program is created.


Why is that? Well, if you follow our best practices for cloning, most of your assets have extremely generic names, like Email or Registration Page. This can make it really hard to find assets in drop down lists, especially as you add more and more programs to your instance and you get more and more assets with similar names. To compound this problem, you probably repeat many of the same types of activities over and over again. Maybe you have regular demo webinars. Their program names in Marketo are probably virtually identical. It makes it very easy to accidentally select the wrong one if you are rushing or not able to see the full program name easily.

Now let’s say that you have the program ID (1130) in the naming convention for the next month’s webinar: WBN-2015-1130-July-Demo-Webinar. While you’re working on setting that up, all you need to do is type the program ID in the dropdown lists instead of the word Invitation and now you get a much narrower list of options:


Similarly, this can be very helpful when you are using Request Campaign:


This might seem like a minor thing, but if you’re in the system all day navigating thousands of programs, it ends up saving you time and headache. Give it a try and see what you think; you may like it too.