Hello, Chronoform people: Im trying to make a referral program Im my website. I found this tool http://www.willmaster.com/library/features/visitor-page-view-history-breadcrumbs.php#G1282419260064 to track visitor´s web history in Javascript with cookies. Because my contact forms sometimes are at 2 or 3 links of landing page that I build in HTML; the HTTP_REFERER method that Im embedded in framed Chronoforms sometimes dont allow me to track the affiliate link referral. The only way I can control this problem is with the usage of the mentionated tool. The problem is that I really dont know how to execute this Javascript simultaneusly with Chronoform and send the values that the retrieve JS generates in a hidden field with my chronoforms.
This is the javascript code for web history tracking
This + the above, is the code for retrieve harvested info:
It it´s posible to run this JS with chronoforms and save the result in a hidden field to send with email.
Im very bad at programming please help me!
This is the javascript code for web history tracking
<script type="text/javascript"><!--
// Obtained from http://www.willmaster.com/
//
// Specify maximum number of history links to keep,
// minimum 1.
var MaximumNumberOfLinks = 15;
// Specify cookie name.
var CookieName = "HistoryLinks";
// Specify number of days cookie is to remain on visitor's
// computer. (Use 0 to delete cookie when browser closed.)
var DaysToLive = 366;
// No other customizations required.
var HistoryLink = new Array();
var HistoryTitle = new Array();
var CurrentPage = new String();
var HistoryContent = new String();
DaysToLive = parseInt(DaysToLive);
MaximumNumberOfLinks = parseInt(MaximumNumberOfLinks);
if( MaximumNumberOfLinks < 1 ) { MaximumNumberOfLinks = 10; }
function GetCookie() {
var cookiecontent = '';
if(document.cookie.length > 0) {
var cookiename = CookieName + '=';
var cookiebegin = document.cookie.indexOf(cookiename);
if(cookiebegin > -1) {
cookiebegin += cookiename.length;
var cookieend = document.cookie.indexOf(";",cookiebegin);
if(cookieend < cookiebegin) { cookieend = document.cookie.length; }
cookiecontent = document.cookie.substr(cookiebegin,cookieend);
}
}
if( cookiecontent.length < 3 ) { return; }
cookiecontent = unescape(cookiecontent);
var historyList = cookiecontent.split('&');
for( var i = 0; i < historyList.length; i++ ) {
var link = historyList[i].split('=',2);
HistoryLink.push(link[0]);
HistoryTitle.push(link[1]);
var temparray = link[0].split('~amp;');
link[0] = temparray.join('&');
temparray = link[1].split('~amp;');
link[1] = temparray.join('&');
HistoryContent += '<'+'p>'+'<'+'a href="'+link[0]+'">'+link[1]+'<'+'/'+'a>'+'<'+'/'+'p>';
}
}
function PutCookie() {
if( HistoryLink.length < 1 ) { return; }
var len = HistoryLink.length;
while( HistoryLink.length > MaximumNumberOfLinks ) {
HistoryTitle.shift();
HistoryLink.shift();
}
var pairs = new Array();
for( var i = 0; i < HistoryLink.length; i++ ) { pairs.push(HistoryLink[i]+'='+HistoryTitle[i]); }
var value = pairs.join('&');
var exp = new String();
if(DaysToLive > 0) {
var now = new Date();
now.setTime( now.getTime() + (DaysToLive * 24 * 60 * 60 * 1000) );
exp = '; expires=' + now.toGMTString();
}
document.cookie = CookieName + "=" + escape(value) + '; path=/' + exp;
}
function RecordCurrentPage() {
var link = document.URL;
var title = document.title.length > 1 ? document.title : 'Untitled';
CurrentPage = '<'+'p>'+title+'<'+'/'+'p>';
var temparray = link.split('&');
link = temparray.join('~amp;');
var temparray = title.split('&');
title = temparray.join('~amp;');
HistoryLink.push(link);
HistoryTitle.push(title);
}
GetCookie();
RecordCurrentPage();
PutCookie();
//--></script>
This + the above, is the code for retrieve harvested info:
<script type="text/javascript"><!--
if(HistoryContent.length) {
document.write('<'+'div ');
document.write(' id="visitorhistory" ');
document.write(' style="border-style:solid; border-width:1px; padding:0 5px 10px 20px;">');
document.write('<'+'h3>You were here:<'+'/h3>');
document.write(HistoryContent);
document.write('<'+'h3>You are here:<'+'/h3>');
document.write(CurrentPage);
document.write('<'+'/div>');
}
//--></script>
It it´s posible to run this JS with chronoforms and save the result in a hidden field to send with email.
Im very bad at programming please help me!