Hi, every one

am trying to capture referral data from various sources using ColdFusion such as Google Adwords, Yahoo, MSN, Google etc.

I have done this in the past using PHP as it allows access to the header variables, but I'm rather rusty when it comes to ColdFusion having only lightly touched on it during me degree many years ago.

What I need to ask is, is there a way that I can capture the URL a visitor has come to me from using ColdFusion, so I can report back to my superiors and say "this many visitors came from Google Adwords, this many came naturally via MSN, this many came naturally via Yahoo etc." ?

Thankful for any help anyone can give.

Recommended Answers

All 3 Replies

Use the CGI.HTTP_REFERER variable.

<cfoutput>#CGI.HTTP_REFERER#</cfoutput>

If it returns blank, it means they got to the page directly (user was not taken to it via a URL).

If you want to see a list of other avaiable cgi options, do this code

<cfdump var="#cgi#">

That will show you all kinds of stuff about what the server is storing for you.

If it returns blank, it means they got to the page directly (user was not taken to it via a URL).

.. or that value is blocked by firewall s/w.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.