Helpful Information
 
 
Category: ColdFusion
CGI.HTTP_REFERER blank!

ok I am trying to track visitors to our website. We use a link at the bottom of the page to cature the information:

img src="http://xxxxxxx.com/w.cfm?l=63&r=#CGI.HTTP_REFERER#" border="0" width="0" height="0"

Here is the code that process it:


<cfquery name="insertWebpageOpenInfo" datasource="clicktrackSystem">
INSERT INTO Clicks (linkID, ipAddy, referer, agent)
VALUES (<cfqueryPARAM value = "#url.l#" CFSQLType = 'CF_SQL_INTEGER'>, "#CGI.REMOTE_ADDR#", <cfqueryPARAM value = "#url.r#" CFSQLType = 'CF_SQL_VARCHAR'>, "#CGI.HTTP_USER_AGENT#")
</cfquery>


Everything inserts fine, but when I google our site, or yahoo, or ask it, the referer is blank. I have also tried just using links from other websites...nothing works, the referrer is always blank. Any suggestions?

<3Kacie

Do you have privacy enabled in your browser or firewall? Either one can blank out the referrer field so that web sites can't tell where you came from.

I've found that REFERER is one of the least dependable of the CGI variables. It seems almost anything can block the information - security settings on browsers, security settings on firewalls, browsers using different interpritations of the HTTP spec (some only report referer on POST and not the more common GET).

Also, a side note, I hate the REFERER is misspelled.

I just don't know because the R E F E R E R works in other places. I have made this tracking system myself, with the help of my boss, and its to track links and open rates on e-mails. Well this is another part of it. It sends the R E F E R E R when the e-mails are opened through a web mail service like yahoo or gmail. It also works if I don't put it in a variable (like shown in the code above) for the website, only the R E F E R E R is the websites homepage, since that is where the 'picture' is being accessed from. So this is why I had to put it in the URL variable so that it would capture the R E F E R E R from the site they were coming from and not from the site the picture is accessed on. I am thinking something must be up w/ my code.

the problem was here:

img src="http://xxxxxxx.com/w.cfm?l=63&r=#CGI.HTTP_REFERER#" border="0" width="0" height="0"

this link is created in the tacking system and then displayed so you can cut and paste it where ever you need it, here was the code that made the link to be displayed for cutting and pasting:


#HTMLEditFormat('<img src="http://glyphlink.com/w.cfm?l=#getLinkInfo.linkID#&r=##CGI.HTTP_REFERER##" border="0" width="0" height="0">')#

What I was missing was cfoutput


#HTMLEditFormat('<img src="http://glyphlink.com/w.cfm?l=#getLinkInfo.linkID#&r=<cfoutput>##CGI.HTTP_REFERER##</cfoutput>" border="0" width="0" height="0">')#

so now when the link is displayed to cut and paste is shows <img src="http://glyphlink.com/w.cfm?l=XX&r=<cfoutput>#CGI.HTTP_REFERER#</cfoutput>" border="0" width="0" height="0">
why it wanted cfoutput to process the R E F E R E R? I don't know, but whatever it works now, thanks for your help










privacy (GDPR)