Occasionally marketers need to pass dynamic fields (field merges) to a destination page from an Eloqua email. While Eloqua supports this functionality, it does not however support tracking clickthroughs of links that contain field merges where the destination page isn't tracked by Eloqua. This tutorial will show you how you can use a custom object, form, and a landing page with some custom Javascript to accomplish click through tracking for dynamic redirects that contain field merges.
When would I need this?
An example could be if you use a survey tool that requires a unique variable for each recipient. You'd store the unique token on the contact record, and include it as a field merge in the hyperlink. This works great, however you lose the ability to view the clickthroughs of that link. This tutorial will show you how you can track when a user clicks the link, and have that link automatically go to the destination page while including any dynamic parameters you want to pass.
Part 1 - Watch the tutorial video
How to Create Dynamic Redirects in Eloqua Tutorial - YouTube
The easiest way to demonstrate the functionality was through video. I recommend watching the tutorial in its entirety in full-screen mode (it'll be easier to read), and then continuing with some additional information below.
Part 2 - Form field names
The custom object and form fields will need to have the following names:
Note: The html name is only applicable to the form
Field | HTML Name | Data Type |
Email Address | text | |
Dynamic Redirect Link | link | large text |
Email Name | emailName | text |
Link Title | linkTitle | text |
Part 3 - The HTML/Javascript
<!DOCTYPE html><html><head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>DocuSign</title> <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script> <script type="text/javascript" language="javascript"> $(function() { /* === EDIT HERE === */ var elqPostUrl = "http://XXXX.t.eloqua.com/e/f2"; var elqSiteID = "123456789"; var elqFormName = "YourFormName"; /* === DO NOT EDIT BELOW THIS LINE === */ // Construct redirect var get = get_query(); var redir = ""; var params = "?"; var url = ""; var vars = {}; for(var param in get){ if(param == "redir"){ redir = get[param]; }else{ if(get[param] == "undefined"){ continue; } vars[param] = get[param]; params += param + "=" + get[param] + "&"; } } params = params.substring(0,params.length - 1); url = redir + params; // Validate required fields are present if (redir == "" || vars.email == "" || vars.linkTitle == "" || vars.emailName == ""){ $('body').html("The following parameters are required:<br />redir<br />email<br />emailName<br />linkTitle"); return false; } // Eloqua form details var elq = {elqPostUrl: elqPostUrl, elqSiteID: elqSiteID, elqFormName: elqFormName, email: vars.email, link: url, emailName: vars.emailName, linkTitle: vars.linkTitle}; // Post to Eloqua form for tracking var posting = $.post(elq.elqPostUrl,elq,function(data){},"jsonp"); // using jsonp to ignore response posting.always(function(data){ // Redirect after form processes $(location).attr('href',url); }); // Parse query strings function get_query(){ var url = location.href; var qs = url.substring(url.indexOf('?') + 1).split('&'); for(var i = 0, result = {}; i < qs.length; i++){ qs[i] = qs[i].split('='); result[qs[i][0]] = decodeURIComponent(qs[i][1]); } return result; } }); </script></head><body></body></html>
Or download at: http://bit.ly/11Hv2hq
You will need to edit lines 18, 19, and 20 per the instructions in the video.
Part 4 - Sample hyperlink with field merges
http://your-domain/your-link?emailName=Dynamic Redirect Custom Link Example&linkTitle=Sample Link&redir=http://www.google.com&title=<span unselectable=on class=eloquaemail>Title1</span>&email=<span unselectable=on class=eloquaemail>EmailAddress</span>
This is an example link, you can add as many custom parameters and field merges as needed. The custom landing page with the javascript is configured to automatically handle all parameters, log them to the custom object, and forward them to redirect page.
Conclusion
That's it! This should work for any Eloqua environment, however, I highly recommend thoroughly testing this process each time you need to use. Every system is a bit different, so extra testing doesn't hurt
Please post any questions or PM me if you need any help.
Cheers,
Ryan