In his last post, Loren showed how Tourbuzz is using Mandrill's search API to show customers their email history inside of the Tourbuzz application. Of course, advanced searching is not limited to the API. It's also available inside the application. Mandrill searches utilize Lucene queries, which means you can search by a single term, phrases (surrounded with double quotes), multiple terms (using the Boolean operators AND, OR, and NOT) and wildcards (* for multiple character wildcards and ? for single character). And by default, Mandrill searches all indexed fields, including any custom metadata that you've added. All that information is just one search field away.
Digging Into Search
One of our customers, we'll call him Tim, runs a School of Enchantment (it's possible that Tim is a hypothetical customer). He had a few questions about using search to gain insight into the performance of one of their transactional emails, so let's help him out.
When students sign up for a class they receive a welcome email that contains links to an online store (where students can buy scrolls, potions, wands, etc.) and to a forum where students can chat with each other and their instructor. He wants to see the performance of those emails. Ideally those emails would be tagged with something like 'class-welcome', so one can search and filter by that later. But, this was a last minute addition, time was short and the semester was starting, so that part was kind of skipped and we can't search by tag. The emails, however, do share the same subject template "Welcome to the [class name and number] class". This gives us a great hook to use when searching for the emails:
subject:"Welcome to the * class"
We're limiting the search to a specific field using 'field_name:' before the search term and since the emails all use the same subject template we can use the multiple character wildcard in the 'subject:' search term.
Tim also wants to see how each departments class emails are performing. Luckily, they do have a tag for each department, so we can add departments to the search using the AND Boolean operator.
subject:"Welcome to the * class" AND tag:potions
Now he can run a similar search using each departments tag to check up on their class email stats.
Searching Custom Metadata
As Tim looked through the results he realized that the Alchemy students really seemed to be using those links (spoiler, it turns out that Alchemy is kind of tough). After he found that out, he wanted to see if there was a particular grade level of students that used those links more than others. When Tim hooked Mandrill up he added a 'grade-level' custom metadata field for the grade level of each of the students. Now he can append a search of the 'grade-level' metadata to the previous search to look at the stats from different grade levels, like so:
subject:"Welcome to the * class" AND tag:alchemy AND u_grade-level:mage
Stats are good, but it's also nice to be able to do something with them. By drilling down and looking at different segments of their students, Tim can get some pretty good insights into how these segments are interacting with their transactional emails. And that, in turn, can lead to changes in the emails they're sending out by adding or removing links and content depending on the segment that the recipient is in.
Oh, and in case you're interested, Apprentices click those links almost all of the time. Intro to Alchemy has a reputation as a weed out class, so they jump right over to the forums to get help as soon as they enroll (and I'm guessing they also head to the store to buy gold and books on sleight of hand).