/****************************************************
     Author: Brian J Clifton
     Url: http://www.advanced-web-metrics.com
     This script is free to use as long as this info is left in
     
     Script for tracking the referrals of people who click on a SurveyMoney link within Wordpress
     
     All scripts presented have been tested and validated by the author and are believed to be correct
     as of the date of publication or posting. The Google Analytics software on which they depend is 
     subject to change, however; and therefore no warranty is expressed or implied that they will
     work as described in the future. Always check the most current Google Analytics documentation.

****************************************************/

//function to grab cookie values
function _uGC(l,n,s) {
	 if (!l || l=="" || !n || n=="" || !s || s=="") return "-";
	 var i,i2,i3,c="-";
	 i=l.indexOf(n);
	 i3=n.indexOf("=")+1;
	 if (i > -1) {
	  i2=l.indexOf(s,i); if (i2 < 0) { i2=l.length; }
	  c=l.substring((i+i3),i2);
	 }
	 return c;
}

var z = _uGC(document.cookie, "__utmz=", ";");
urchin_source = _uGC(z,"utmcsr=", "|");          //alert(urchin_source)
urchin_medium = _uGC(z,"utmcmd=", "|");          //alert(urchin_medium)
urchin_term = _uGC(z,"utmctr=", "|");            //alert(urchin_term)
urchin_content = _uGC(z,"utmcct=", "|");         //alert(urchin_content)
urchin_campaign = _uGC(z,"utmccn=", "|");        //alert(urchin_campaign)


//This is the only line you need to edit. Change the URL to your SurveyMonkey link, up to the &c
survey_url = "http://www.surveymonkey.com/s.aspx?sm=76mzsLpd1yLs50xcaw5A8g_3d_3d&c=" +urchin_source +"_"+ urchin_term

//replace "survey here" with what ever you like
document.write("<a href=" +survey_url+ " target=_blank>Feedback survey</a>")