Skip to main content

Ever wanted to know how a visitor found your site but are too lazy to go look up the stats?  Collect the referrer information on the homepage and store it in a session.  When they fill out a contact form collect that info and there you go.  The below code assumes you have a windows server or unix with chilisoft installed, and that your have a contact form that fires off an email. Now for the code:

Step 1: Paste this asp code on your home page near the top.

<%Dim referrer
Session("REFERER")= Request.ServerVariables("HTTP_REFERER") %>

Step 2: Setup your contact form to collect the variable.

<INPUT TYPE="hidden" NAME="Referrer" VALUE="<%=Session("REFERER")%>">

That’s it, pretty easy huh?  If you were so inclined you could collect a custom variable on each page of your site then loop em out in your contact form to see what pages the user spent time on while visiting your website. Visit Red Olive Design, a Utah web design company for more asp tips.