If you are using Google Analytics, you may want to be able to get the sourcing parameters it uses into Eloqua so that you can understand channel data on an identified contact level, rather than just anonymously in GA. A link tag for sourcing in GA looks like the following:

 

www.yourwebsite.com?utm_source=yoursource&utm_medium=yourmediuam&utm_campaign=yourcampaign

 

If you are pointing links like these to your landing pages, getting these parameters into Eloqua can be done in a few simple steps:

 

First, add three new fields to the contact table that correspond to the source, medium, and campaign parameters you will be logging. Here, we use the same exact name for simplicity, although you don't have to.

 

Second, add the three prameters to your form in Eloqua, data type 'Text', and then either make them hidden or delete them from the form HTML when you put the form on your landing page (you want these fields to work in the background and not show up for the user).

 

form fields.png

 

Make sure the field mapping is correct in your 'Update Contacts - With Form Data' form processing step.

 

Processing Step.png

 

Then you just need to add a bit of javascript to your landing page. It's function is to pull the sourcing parameters out of the URL and pass them into Eloqua upon a form submit. It can be copied and pasted from below, just remember to add two things:

 

1) Add the HTML form name (as indicated in the code below on the line ending "FORM NAME ON THIS LINE")

2) Make sure the database names and the URL names of your 3 fields match what is written in the 'elqForm.elements' section of the script, or change the script to match the names you are using.

 

 

 

 

 

<script type="text/javascript">

var defaultHiddenFieldNameValue = "NoData";

 

function getQueryStringParamValue(strQStrParam) {

var strURL = document.location.href;

 

var strQStrParamValue = "";

 

          if (strURL.indexOf('?') != -1)

          {

                      strQStrParamValue = strURL.substr(strURL.indexOf('?') + 1);

                      if (strQStrParamValue.indexOf(strQStrParam) != -1)

                      {

                                  strQStrParamValue = strQStrParamValue.substr(strQStrParamValue.indexOf(strQStrParam));

                                  strQStrParamValue = strQStrParamValue.substr(strQStrParamValue.indexOf('=') + 1);

                                  if (strQStrParamValue.indexOf('&') != -1)

                                  strQStrParamValue = strQStrParamValue.substr(0, strQStrParamValue.indexOf('&'));

                                  return strQStrParamValue;

                      }else{

                                  strQStrParamValue = defaultHiddenFieldNameValue;

                                  return strQStrParamValue;

                      }

          }else{

                      strQStrParamValue = defaultHiddenFieldNameValue;

                      return strQStrParamValue;

          }

}

 

var form = "YourHTMLformName";          //FORM NAME ON THIS LINE

 

function setCampaign(){

 

  var elqForm = document.forms[form];

  //repeat for each field to populate

 

elqForm.elements['C_utm_campaign1'].value = getQueryStringParamValue('utm_campaign');

elqForm.elements['C_utm_source1'].value = getQueryStringParamValue('utm_source');

elqForm.elements['C_utm_medium1'].value = getQueryStringParamValue('utm_medium');

    }

window.onload = setCampaign;

</script>