UTM (Urchin Traffic Monitor) parameters are used on the Web by Google Analytics to track traffic to a website or page. UTMs are a specific way of using what are more generically referred to as Query String Parameters (QSPs). QSPs can be used to send a variety of extra information to a webpage.
Here is an example of what a URL with UTMs might look like:
http://mygreatsite.com?utm_campaign=myGreatCampaign&utm_medium=email&utm_content=banner&utm_source=internal
Everything after the question mark is the Query String. Items before an equal sign are a Variable, and items after an equal sign are the Variable’s Value.
UTMs can be used by Marketers to:
- Measure Campaign effectiveness
- Identify where Leads are coming from
- Measure Engagement
Capturing UTMs (or any QSP) with JavaScript
QSPs can be read by JavaScript and saved into hidden fields on your Forms. See below for code on how to grab the QSP values and insert them into hidden fields.
const url_params = new URLSearchParams(window.location.search);
const utm_campaign = url_params.get(‘utm_campaign’);
const utm_source = url_params.get(‘utm_source’);
const utm_medium = url_params.get(‘utm_medium’);
const utm_content = url_params.get(‘utm_content’);
document.getElementsByName(“utm_campaign”)[0].value = utm_campaign
document.getElementsByName(“utm_source”)[0].value = utm_source
document.getElementsByName(“utm_medium”)[0].value = utm_medium
document.getElementsByName(“utm_content”)[0].value = utm_content
Include Google Analytics in your page as you normally would.
What is going on in the Script?
URLSearchParams() interface defines utility methods to work with the query string of a URL, it can iterate through the query string based on a name and retrieve its value.
getElementsByName() sets an input field with the defined name to the appropriate QSP value.
You will need to be sure the names used in the script match the HTML names of the hidden fields you will create in Eloqua.
Save the Data somewhere (Eloqua)
- Eloqua Forms require a hidden field for each UTM being captured
- Create your Form in Eloqua (use hidden fields, and not text fields)
- Name the fields the same in Eloqua as in the code above
- This will result in the following hidden fields in the generated HTML (Eloqua will also add IDs, I have left them out):
<input type=”hidden” name=”utm_source” />
<input type=”hidden” name=”utm_medium” />
<input type=”hidden” name=”utm_content” />
<input type=”hidden” name=”utm_campaign” />
Use the Data
Add the Form Processing Step, “Update Contacts – With Form Data” to save each field to a corresponding Contact field. Or, use, “Update Custom Data Object – With Form Data” to save to a CDO. Once the data is saved to one of these records, you will be able to use it in Segmentation, Personalization, and Reporting. Another way you can use these values is to add conditional steps in your Form Processing based on the field values. Maybe you need to send an Email notification to someone within your Organization for a given Form. With a conditional Send Notification Email step, you can ensure an Email is sent out only when it is necessary.
Click on this link, change the URL and you will receive an email with your QS.
Your Journey Begins…
UTMs are a great way to supplement your understanding of your Eloqua Contacts. With a little bit of code, you can capture that information within your Eloqua database, as well as within Google Analytics. Furthermore, you are not limited to capturing UTM Parameters. With this technique you can obtain any QSPs for other uses. Other ways in which you can use this information are for custom Thank You page routing, notifying specific Stakeholders within your Organization, moving Contacts into more appropriate Campaigns, and much more!
At Tegrita, we regularly use UTMs and QSPs to help our Clients maximize their use of Eloqua. Information gathered from QSPs can be used to inform Marketing, Sales, and to create special User Experiences. For more information on how we can help you, reach out to us today!