Exclusion Script for Journey Builder

Building out your audience is one of the most challenging parts of Email Marketing. There are many ways to do it, but the more complicated your audience gets the more likely people are to give up and wait till they can get some bandwidth from a data scientist.

Before you throw your hands in the air, let me show you a way to utilize exclusions to get to your perfect audience.

Let’s start with a standard Venn Diagram:

Normally when you look at a Venn Diagram you are looking at the AB section, the overlap. But today I want to show you how to use a data extension to get only one side – without the overlap.

When you go to send an email you have the opportunity to both include and exclude an audience. Journey Builder on the other hand only allows audience inserts and setting a single suppression group. If what I want is only the A chunk, without the overlap. Then I can restate it as wanting everyone in Data Extension A, but do not include anyone in Data Extension B.

You can add in that exclusion in a couple of ways:

You could set up a decision split that uses that data to break the traffic into 2 paths – one that is allowed to go forward and the other that sends them to a path that just exits. This is a pretty straight forward setup, but it requires you have that data extension set up in data designer so those attributes are available on the journey canvas.

The other option is to utilize an exclusion script on each of the emails. This script serves the same purpose as the exclude selection in the email send UI.


ROWCOUNT(LOOKUPROWS(“data_Extension_name”, “NAme_of_column_that_houses_emailaddress”, emailaddr))> 0

To use the exclusion script, simply copy it into the Exclusion Script Field under Delivery Options-

Advanced Example:

Let’s say you are a school district and you want to be able to split your audience into parents of kids in primary school (K-8) and parents of kids in secondary school (9-12). All the parents live in the same DE (master_parents_DE) and is updated in real-time. You want to make sure if a student changes from primary to secondary, that the parents should no longer get the emails aimed at the primary school parents.

You can adjust the exclusion script to check that they are in the data extension and what the value is for the school level. To do so, you would add an additional parameter to the script.

Rowcount(LookupRows(@DEName, 'EmailAddress', emailaddr, 'SchoolLevel', 'Primary')) > 0

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.