I am trying to implement my first udf
http://www.cflib.org/udf.cfm?id=585&enable=1
which list the keywords received in a cgi.http_referer but I
don´t understand it properly.
I have the udf on one page saved as a .cfm which is included
on the Application.cfm (please see UDF code below)
My script which I put on the same page is here:
<cfset greferer= cgi.http_referer>
<cfoutput>
Keywords from #referer# =
#GetGoogleKeywords(greferer)#<br>
</cfoutput>
How do I implement this rigth? Thank you
UDF:
<cfscript>/*
** Pass it a http_referer value and this fuction will parse
out the keywords used to find it if referred from Google.
*
*
@Param referer The referer string to check. (Required)
*
@Return Returns a string.
*
@author Matthew Fusfield
(matt@fus.net)
*
@version 1, June 28, 2002
*/
function getGoogleKeywords(referer) {
var Keywords='';
var StartPos=0;
var EndString='';
if (referer contains 'google.com') {
StartPos=ReFindNoCase('q=.',referer);
if (StartPos GT 0) {
EndString=mid(referer,StartPos+2,Len(referer));
Keywords=ReReplaceNoCase(EndString,'&.*','','ALL');
Keywords=URLDecode(Keywords);
}
return Keywords;
}
else {
return '';
}
}</cfscript>