Take the first step towards becoming an attribution master by learning how to set up Marketo UTM tracking programs and smart campaigns to match website visitors to particular ad campaigns, set first and latest touch attribution fields, and track downstream conversions to signup or contact sales forms.
This post will focus on tracking UTM parameters but if you want to learn how to track organic referral, social, and search visits with your Marketo campaigns so they DON’T STEAL ATTRIBUTION FROM YOUR PAID CAMPAIGNS then take a look at the Marketo Anonymous Leads & Attribution post.
As a bonus for the eager beavers among us, I will also show you how you can streamline the process from a marketing team member requesting UTM parameters all the way to setting up tracking for these parameters in Marketo using the API.
If you want hands-on video walkthroughs of how to get set up with the Marketo API and see real-life marketing operations use cases for the API then check out the Marketo API Crash Course using the button below 🙂
Within the Marketo UTM Tracking program, there are 4 different smart campaigns responsible for tracking visits or conversions and moving a person to the appropriate status in the program. Moving people to these program statuses is important because this allows us to report on cost per lead and cost per success within Marketo.
The “Marketo UTM Tracking Campaign” and “Marketo Conversion Tracking Campaigns” sections below detail the setup of the 01 Visit, 02 Contacted, and 02 Converted smart campaigns. The setup of the 03 Anonymous smart campaign is detailed in the Marketo Anonymous Leads & Attribution Tracking post.
The first step when creating a Marketo UTM tracking program is to create a “Default” program type and set the “Channel” to your paid advertising or attribution channel. In this example the “PPC” channel is being used which has the “Visited” status to track anyone who visits our website from an ad campaign and the “Converted” or “Contacted” status to track anyone who signs up or contacts sales straight from the ad campaign.
The 01 Visit campaign, uses local program tokens within its flow steps to update attribution fields to these token values. Since these token values can be populated using the Marketo API (see the “Preparing Marketo UTM Tracking Smart Campaigns” section below) this means that the values the attribution fields will be set to can indirectly be changed by the API.
If you want to see possible values that the lead_source, lead_source_detail, source, medium, and campaign tokens can have then check out the Key tab of the “UTM Builder” sheet. To see how these tokens are used in the “Change Data Value” flow steps then read on!
Marketo UTM Tracking Campaign
Marketo UTM tracking is achieved by using the “Visits Web Page” trigger along with the “Querystring” constraint to ensure that only web page visits with the desired UTM parameters matching our ad campaign are tracked.
Then the flow kicks off to:
Change the person’s program status to “Visited”
Set the person’s Latest Touch field to the UTM querystring using the {{my.utm}} token. This Latest Touch field will be used in the conversion campaigns below to see if this ad campaign was the last thing the person interacted with before signing up or contacting sales.
If the person’s Person Source field is empty then update the Person Source and Lead Source Detail fields to be the {{my.lead_source}} and {{my.lead_source_detail}} tokens respectively. These are a person’s first touch attribution fields that can be used for attribution reporting later on.
4. Update the utm_source, utm_medium, and utm_campaign fields to each of the corresponding UTM parameters. These 3 fields are supplemental to the Person Source and Lead Source Detail fields to provide more information, the utm_campaign field especially, about where a lead came from. The utm_source and utm_medium fields can be removed, if desired, since their information is already contained in the Person Source and Lead Source Detail fields.
5. If the person’s Acquisition Program is empty then set the Acquisition Program to the parent program of this smart campaign and the Acquisition Date to the {{system.dateTime}} token. Setting these 2 fields is the most important requirement for doing program performance and attribution reporting in Marketo.
Marketo Conversion Tracking Campaigns
Remember that “Lastest Touch” field we set in the Marketo UTM tracking campaign flow above? Well whenever we get a person who signs up or contacts sales with this “Lastest Touch” field equal to the UTM querystring of our ad campaign then we know this ad campaign was the last thing they interacted with before carrying out these actions.
This is achieved by including the Lastest Touch = UTM Querystring as a filter along with the triggers and other filters mentioned below.
A Contact Sales Conversion occurs whenever anyone fills out one of the contact sales forms and the Reason for Contact is a Sales Inquiry because in my company’s case we did not want to mark support or legal requests as conversions.
A Signup Conversion occurs whenever a person’s online portal id i.e. mc user id, gets populated (for people who already exist in Marketo) or someone is created from the Web Service API with their mc user id already populated
Then we will set this person’s status in the Marketo UTM tracking program to either Converted or Contacted depending on which of the above smart campaigns they passed through.
Marketo Anonymous Leads Campaign
Marketo anonymous leads are a wily beast! While anonymous leads can qualify for campaigns with visit webpage triggers while anonymous e.g. our Marketo UTM tracking campaign above, they will not appear as a member of this smart campaign until they become known i.e. they fill out a form on your site or get unanonymized another way.
Additionally, when a lead becomes known they will pass through the flows of all smart campaigns that they qualified for when they were anonymous BUT here’s the rub:
They are not guaranteed to pass through the smart campaign flows in the same order that they actually qualified for the campaigns [future post coming soon with an example]. For example, if they do Action 1 to qualify for Campaign 1 at 1 o’clock and then do Action 2 to qualify for Campaign 2 at 2 o’clock we are not guaranteed that the person will go throw the flow of campaign 1 before the flow of campaign 2 once they become known.
The Change Program Status step will not work.
Therefore, the Anonymous smart campaign is scheduled to run periodically and take anyone who is a member of the Marketo UTM tracking campaign and add them to the program in the Visited status if they are not already a member of the program i.e. they have not passed through the Converted or Contacted smart campaigns.
You might be wondering how they can be known without having passed through the Converted or Contacted smart campaigns of this program and already being a member. Well this can happen when this person becomes known from a campaign in a different program e.g. another UTM tracking program, a webinar program, an email program etc, and while they will be a member of this other program they will not be a member of this current program until the Anonymous smart campaign runs.
Since the Converted and Contacted campaign triggers are based on a person filling out a form, being created i.e. unanonymized, or an existing known lead’s data value changing, the lead is already known when passing through the flow of these campaigns so the Change Program Status step works.
Automating UTM Creation & Tracking
Now that you understand how the Marketo UTM tracking program and campaigns are set up, I will show you how you can automate the creation of these programs and campaigns using the Marketo REST API and Zapier.
To do this we will use:
A Google Form that will send UTM requests from marketing team members to a Google Sheet triggering a Zap in Zapier to run
This Zap will then take the inputs to the Google Form and create the desired UTM parameters using formulas within another UTM Builder Google Sheet
The Zap will then create a Marketo UTM tracking program and smart campaigns specific to the newly created UTM parameters
Finally, a Jira ticket will be created for Marketing Operations to check that the Marketo UTM tracking program and campaigns were created correctly and then activate the smart campaigns
All the Python code used within the “Code by Zapier” actions can be be found in the “marketo_utm_tracking_automation” directory in Github.
N.B. If it is your first time using the Marketo API or you need a quick refresher then check out theMarketo API Quick-Start Guide to see how to make your first Marketo API requests in Postman before transitioning to making requests in code or in the Zapier automation tool.
Collecting UTM Requests from Google Forms
The first step in the whole process is to create aGoogle Form that will allow a marketing team member to fill out their ad campaign details so that we can automatically create the necessary UTM parameters later on in the UTM Builder sheet. The important thing here is to not require any text entry and only allow the marketer to select from existing options so that you will always know the options available in your form and can thus configure your UTM Builder Google Sheet to create the corresponding UTM parameters for these inputs.
Every new submission to the UTM Request Form gets logged in the UTM Request Form Responses sheet, which in turn triggers the Marketo UTM Tracking Automation Zap to run in Zapier.
Creating UTM Querystring using Google Sheets Formulas
Once the Zap has been triggered, the next step is to take the row ID of this latest submission and use that to search for the row currently filled with “Next Row #” in the UTM Builder sheet.
Originally, this zap was set up so that this step searched for the next empty row in the “UTM Builder” sheet, however, when multiple form submissions were made in quick succession it would turn out that the same row in the “UTM Builder” sheet was being written to/overwritten for each of the submissions.
To get around this race condition, the Campaign Name column in the “UTM Builder” sheet is populated with Next Row # where the row numbers being used correspond to the next available empty rows in the “UTM Form Responses” Google Sheet. This way each successive UTM form submission will be in a a different row in the “UTM Form Responses” sheet and thus will lookup a different row in the “UTM Builder” sheet.
Once the correct row in the “UTM Builder” sheet is found, the Channel and Sub-Channel values are populated from the form submission, at which point the formulas in the Google Sheet take over to create the UTM parameters and querystring automatically.
Creating a Marketo UTM Tracking Program
Now that the UTM querystring for the ad campaign has been created we want to create the Marketo UTM tracking program and campaigns.
The next 5 “Code by Zapier” steps use Python code to make requests to the Marketo REST API to:
Get the Marketo access token that is needed to make subsequent requests to the Marketo API (get_marketo_token.py)
Get the yearly paid campaigns folder for the current year or create it if it does not already exist (get_year_folder.py)
Get the monthly paid campaigns folder for the current month or create it if it does not already exist (get_month_folder.py)
Get the most recently created previous Marketo program for the sub-channel of the ad campaign we want to track or if a previous Marketo program cannot be found then default to using a template program (get_latest_program.py)
Clone the previous Marketo program for this sub-channel, creating it within the current monthly paid campaigns folder (clone_program.py)
Preparing Marketo UTM Tracking Smart Campaigns
If Step 8 to clone the latest Marketo UTM tracking program for a particular sub-channel is successful then the program ID of the newly created program will be returned. However, I often found that although Marketo was able to successfully create the new program it did not return the successful response and program ID to Zapier within the 10-sec timeout limit imposed on every Zapier action. Therefore, Step 8 would fail along with all the subsequent steps in the zap, which depend on the returned program ID.
In order to remove the dependency on Step 8, Step 9 (get_new_program.py) was added for redundancy and gets the program ID of the newly created program by looking up the name of the program we know was created in Step 8. Now all subsequent steps will use the program ID returned from Step 9 so if Step 8 is ever marked as failed the rest of the zap can continue.
The next 3 “Code by Zapier” actions:
Take the channel, sub-channel, and utm parameters for the ad campaign from Step 3 and use these to populate the utm, lead_source, lead_source_detail,source, medium, and campaign local program tokens (update_program_tokens.py).
Get the ids of the 4 smart campaigns nested under the Marketo UTM tracking program (get_smart_campaigns.py).
Update the description of these smart campaigns to be the UTM parameters querystring so that it is easy for us as the marketing operations person to copy this value and use it within the smart campaign (see the “Manual Input Required from Marketing Operations” section below)(update_smart_campaigns.py).
Notifying the Marketing Operations Team
Once the Marketo UTM tracking program and campaigns are ready, we then need to create a ticket for the marketing operations team so that they can review the program and campaigns and do the small bit of manual work outlined below.
The email address associated with the “UTM Request Form” submission is used to lookup the Jira ID for this person
This Jira ID is then used in the “Reporter” field when creating the Jira ticket (see image below)
The Jira ticket is then moved from the backlog into the “To Do” column of the marketing operations person assigned to the ticket
A Slack message, email, or SMS notification containing the same information as in the Jira ticket could also be added here.
Manual Input Required from Marketing Operations
Since the Jira ticket contains a link to the Marketo UTM tracking program that was created by the Zap, it is very easy for marketing operations to open up this ticket and go straight to the Marketo program.
While tokens can be used in “Change Data Value” flow steps they cannot be used in the “Querystring” constraint of the “Visits Web Page” trigger in the “01 Visit” smart list or in the “Lastest Touch” filters in the “02 Contacted” or “02 Converted” smart lists.
This is why manual input is required to update the smart lists with the UTM querystring for the ad campaign. Thankfully, our “Marketo UTM Tracking Automation” zap updated the description of these smart campaigns to be the UTM querystring so we can copy the querystring right from the description before pasting into the smart lists.
Once all the smart campaigns have been activated or scheduled the last piece of manual work required is just to set up the “Salesforce Campaign Sync” so that the leads generated from this Marketo program can be sent to a corresponding Salesforce campaign.
Marketo UTM Tracking Related Content
Now that you have mastered Marketo UTM tracking and you have streamlined the hand-off from your marketing team to the marketing operations team you can move on to tracking organic visits to your site and reporting on the effectiveness of each of your marketing channels.
Marketo Anonymous Leads & Attribution: Understand the nuances of anonymous leads in Marketo and what you need to be aware of when building the organic attribution campaigns that these leads can qualify for.
If you want to get started on adding period costs to your paid ad programs in Marketo so that you can report on “Cost Per Acquisition” then take a look at theZapier Nested Looping using Webhooks & Python, which shows you how to automate this process.
About The Author — Tyron Pretorius
Greetings fellow MO Pros! As a previous mechanical engineer turned marketing operations lead, I now fancy myself as a full-stack marketer capable of designing websites, writing SEO-optimized content, and doing all the tracking and automation on the backend.
That being said my bread and butter is marketing operations and I love to get down and dirty with the Marketo API, Python, Zapier, and Google Scripts.
Created with the assistance of DALL·E Introduction and Background In 2018, Edward Unthank introduced the four pillars of marketing operations, setting the stage for the management of effective marketing technology (Martech) functions. These pillars have since been the bedrock for many successful careers in marketing operations. My journey to redefine
Introduction When it comes to account-based marketing (ABM), your marketing team might have invested in intent data, built tailored content, and spent time targeting accounts. But is the juice worth the squeeze? You could say marketing operations teams are there in part to squeeze every last marketing dollar in order
Introduction: Blending Human and Technical Perspectives in Martech Caption: Future gardens of martech will blend human and AI perspectives As a co-host of the Humans of Martech podcast, I’ve had the privilege of interviewing some of the brightest minds in marketing technology. This unique experience has provided a blend of