I have recently been working with a client who is implementing ClickDimensions marketing automation solution. Part of the solution allows website form captures to be created within Microsoft Dynamics CRM as either a lead or a contact.
Overview
ClickDimensions form handling after submission is fairly limited in terms of what happens once the user clicks on submit. Currently there are two outcomes:
The user is redirected to a static success page or a static error page.
In the world of internet marketing a static page fails to meet the needs of more advanced websites. The ideal is to be able to redirect to relevant content based on what the user has submitted.
In order to change the action of the form you have to use Progammatic Form Capture.
The ClickDimensions Cookie Challenge
ClickDimensions
Programmatically post the data using server side code. In order to implement this scenario, you must provide special parameters to the posted data which the Form Capture expects. These are:a. Visitor Key (parameter name: cd_visitorkey)
Accessing the details of a cookie is easier said than done this became apparent with the number of people looking to achieve the programmatic form capture described by ClickDimensions. I will go into more detail in another post on how to process the form – this article is simply around the extraction of the Visitor Key from the cookie.
The ClickDimensions cookie is question is called “CUVID” which contains a unique visitor ID.
CUVID Cookie
This cookie is typically written to the browser upon the first visit to the site from that web browser. If the cookie has been deleted by the browser operator, and the browser subsequently visits the site, a new __cuvid cookie is written with a different visitor unique ID. This cookie is used to determine unique visitors to the site and it is updated with each page view. Additionally, this cookie is provided with a unique ID that the application uses to ensure both the validity and accessibility of the cookie as an extra security measure.
The solution was to use some JavaScript to read the cookie content.
<script>
function getCookie(cname) {
var name = cname + "=";
var ca = document.cookie.split(';');
for(var i=0; i<ca.length; i++) {
var c = ca[i];
while (c.charAt(0)==' ') c = c.substring(1);
if (c.indexOf(name) != -1) return c.substring(name.length,c.length);
}
return "";
}
var visitorkey = getCookie("cuvid");
</script>
This reads the CUVID from the cookie which can then be used. I wrote this into a hidden field on the form using.
document.form1.visitkey.value = visitorkey