Eloqua Technical: How to capture exactly which campaign, medium, etc, a lead used to come on to your website even though they navigated around several pages before conversion.
I got asked by a subscriber how they could track UTM parameters on the first touch to their website from all mediums, campaigns, etc because contacts where coming to their website, navigating around and then submitting forms. After I helped them they no longer had a massive black hole in their campaign analytics. Here is exactly how to do it.
Solution
Eloqua Conversion Tags using Google Tag Manager
Introduction
Let’s break this down. In this article I am going to prove 3 things:
- Add UTM marketing source parameters to a cookie to retrieve them later at the point of conversion.
- Take user submitted values from forms.
- Create a Javascript that will successfully send the above data to Eloqua.
I am glad to say that I was able to achieve all of these things technically, and this article outlines how that is achieved in GTM, and how it could be replicated across your entire website.
Get the UTM marketing source parameters into a cookie
This is achievable by creating a variable that takes values from query string, and then setting a cookie when these variables are detected.
Create new User-defined variables of type ‘URL’ and select component type ‘query’. Enter the key of the query string variable you want to use, eg: ‘utm_medium’.
Create a new trigger to fire on page load when ‘utm_medium’ does not equal ‘undefined’.
Create a tag to set the cookie referencing the query string parameters, eg:
<script>
document.cookie = “utmParams={{utm_medium}}_{{utm_source}}_{{utm_campaign}}_{{utm_content}}; path=/; domain=.acme.com;”;
</script>
In this example, the cookie will persist across all acme.com subdomains. You can then create a ‘1st party cookie’ variable in GTM which simply references the name of the required cookie.
User submitted values in the forms
Using the login page on a different subdomain from the main website I were able to create a custom javascript variable which referenced the field in the form we were interested in, eg:
<script>
function(){
var loginEmail = $(‘#Email’).val();
return loginEmail;
}
</script>
This is achievable where form fields have specific IDs. Where not, we can also get these using GTM data layer variables, in this example:
gtm.element.2.value
Creating the conversion tag for Eloqua
The below code references the GTM variable {{Login Email}} and successfully sends it to Eloqua as a conversion. We can add more fields and add them to the string.
Using this example as a template, we could create tracking events for the various conversions on SSE and send the required data to Eloqua on each form submit.
<script>
var emailStr = ‘{{Login Email}}’
var htmlStr = ‘https://s25071713.t.en25.com/e/f2.aspx?elqFormName=GS_GTM_TEST&elqSiteID=25071713&EmailAddress=’ + encodeURIComponent(emailStr);
var req = new XMLHttpRequest();
req.open(‘GET’,htmlStr, true)
req.send()
</script>
Conclusion
This approach has been a great success for the client. They have razer sharp reporting no matter what the user does. We implemented some other things so we could record first and last touch for greater reporting capabilities though that is a story for another day.
Here is all the code you need to get this holy grail of tracking set up.
<!– this is how we document a session level cookie using GTM–>
<script>
document.cookie = “utmParams={{utm_medium}}_{{utm_source}}_{{utm_campaign}}_{{utm_content}}; path=/; domain=.acme.com;”;
</script>
//this code references the ID of the email address field on the login form. We can replicate this for all form fields with an ID
function(){
var loginEmail = $(‘#Email’).val();
return loginEmail;
}
<!– This code sends the required URL to Eloqua, it’s just var htmlStr that needs to change for each different form. –>
<script>
var emailStr = ‘{{Login Email}}’
var htmlStr = ‘https://s25071713.t.en25.com/e/f2.aspx?elqFormName=GS_GTM_TEST&elqSiteID=25071713&EmailAddress=’ + encodeURIComponent(emailStr);
var req = new XMLHttpRequest();
req.open(‘GET’,htmlStr, true)
req.send()
</script>
If you would like me to email you this content so you can use the code or content and images for a presentation click here.
Eloqua Progressive Profiling 3: Hiding standard fields when you have the data
Designing an off the shelf lead nurture engine for Oracle
A few years back Oracle asked me to design an off the shelf partner lead nurturing engine that they could use to enable their partners to market to their own databases on a shared instance of Eloqua. They essentially wanted me to architect what I had created when I...
Eloqua Blog: Lead Nurturing Markie – Runner Up
I am going to switch tack with some more theoretical posts rather than the technical ones. Before I begin though I feel it is appropriate to establish my credibility though in the field as a marketer. It was 2011 and I returned to work at Axios Systems back up in...
Eloqua Blog: New Topics
It has come to the time of year where I need to ask you all what you want me to write about next. Please use the poll below to vote for the topics you want covered, you can also add your own topics... so...
Eloqua Development: Automatically add Query String to all pages links
Background to the problem One of the big problems that marketing has when it comes to using their analytics platforms is that essentially what they have found is that the way they have been setting up their web analytics software means that whenever a contact hits one...