Capture tracking parameters
In the age of digital analytics, everyone uses tracked links. Let's explore how can we use them to support our marketing automation activities.
- Query strings and why you should have them in form submissions
- How to capture tracking parameters with a form?
- Improve your marketing automation with query string capturing
- Use the Eloqua built-in query string functions
Power of query strings
Query strings are everywhere. Search 'value' on Google, and you will see
in the address bar. Open an image on Facebook timeline, and the link will have
at the end. Click any link in the promotional mail you receive, and you will find similar elements
But what they are and how can we use them?
Query string is the part of a uniform resource locator (URL) containing data that does not fit conveniently into a hierarchical path structure.
Despite being a bit vague, this definition tells us a fundamental idea. Query strings are a tool to
transfer data using a
link as a medium. Google Analytics users are familiar with UTM parameters (
Digital marketers use them to identify sources and campaigns that brought users to their
Or, in other words, they use links to send additional data about traffic to Google Analytics. Many
add their queries to fulfil their reporting needs. For example, writing down dimensions of an ad
you find which creation got the best conversion rates and should be used more in the future.
Why would you want such data in our marketing automation tool? Capturing UTM parameters within form submissions allows you to learn what are the primary sources of traffic quickly. That is very handy for both checking if all promotional sources are live and applying more focus to the ones with the best conversion rates to get even more from your campaign. It's faster than Google Analytics and allows you for easy per‑user attribution. Another reason is the ability to utilise query strings to personalise the message. For example, you may link content articles focusing on various legal problems (civil, corporate and data protection law) to a landing page with a whitepaper download form. By capturing UTM parameters, you can personalise e‑mail communication with messaging related to the legal problem mentioned in the source article for each user.
How to capture a query string
We already know that capturing query strings will give you more data for actionable insights and an opportunity to increase engagement with highly personalised communication. Time to show how you can do it.
1. Dedicated fields in the form
To catch tracking parameters, you will need two things. The first - unique fields to store captured information. In the above image, you can see form template with four fields for chosen UTM tags and one field for base URL (the latter being useful if you place one form on multiple landing pages). The number of fields should be equal to the number of query elements you want to catch and store.
The most important part here is to write down unique HTML names you choose for those form fields, as they will be necessary for the second part. The best practice is to make those fields hidden from customers sight. It can be done either within the marketing automation form creator or with simple CSS rules.
Despite the messy look, the script is easy to use. It consists of two functions. First, named
is responsible for splitting the URL into single elements that we can capture. I already configured
so you won't need to change anything there It is the second function,
will be into the spotlight. Within its body, we will configure what URL elements we want to catch
where to put them within the form. As you can see, there are two different lines used.
document.forms[#].html_field_name.value = getQueryStringParamValue('parameter');
The first one captures query strings and to configure it we need to fill in three variables (marked
with red colour above).
# should be a number telling the script which forms on your landing page you want to
In most cases, you will write
0 there (to focus the first/only form). However, if you
to have multiple forms on one page, you can increment that number to target all of them. The second
you will need to fill is
html_field_name. In this spot, you should insert HTML name of
form field where you want to store a particular tracking parameter (as mentioned in
1. Dedicated fields in the form).
parameter, should be equal to the query name you want to catch. For
if the query is
?utm_medium=email, you should end up with
at the end of the line.
document.forms[#].html_field_name.value = window.location.href.split(/[?#]/);
The second line of code catches base URL. Again there is
to fill, just as explained above, but you don't need to write
parameter variable, as
line is already prebuilt to catch base of the link.
Unleash the full potential of URL
I already mentioned how useful capturing query strings might be in the first part of this article. However, there is more. Now that you know how to implement this solution, it is time to abuse its possibilities.
Have you ever thought that it would be great to have Facebook's or LinkedIn's knowledge about their users? Or maybe would love to have more data on your customers, but you are afraid that too long-form will deter them from submission? Let's think about how query capturing can help us.
For example, you want to launch a Facebook ad campaign promoting a whitepaper and targeted to
people interested in law. Now
you can get more from it. Create multiple campaigns (with the same or different creations) focused
more specific groups (different by gender, age, location). To the link leading to a whitepaper form
your query string with different fill for every group:
With query string capturing, you can catch all that information and nurture your database.
Are you planning to put your ads on various third‑party websites with different reader personas? Catch that data and nurture your database. Business partners offered that they can send your e‑mail to their contacts? Query your links, nurture the database. Have a campaign of QR codes in various locations? You know the drill.
Simplified drag and drop solution
What is even more impressive is the fact that you don't have to code even one line to start leveraging the opportunities mentioned above. Oracle's Eloqua offers a simplified version as a built-in feature. To use it all you need to do is to configure two elements.
1. Website Setup » Query Strings
Firstly, within the Assets tab there is a Website Setup menu, where - among other great features, you can find an option called "Query Strings". It allows you to add new query string parameters that will be tracked by Eloqua. Basic configuration takes a second - write selected query string parameter within both Display Name and Parameter fields (for example "utm_campaign") and leave rest of the settings as default. Save, repeat for all parameters queries you want to catch, and done!
2. Field Merge » Query Strings
Now it is time to make use of what you just created. Go to Field Merge library, create new and change Merge From setting from default Contact Field to Query String. Add query string parameter name you want to field merge (one of those you wrote in the previous step) and - you guessed it. Repeat for all parameters, and done!
Mateusz Dąbrowski — 10.07.2018 — Data Code Automation