Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Referral Script
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Referral Script

 Post Reply Post Reply
Author
spikeashlye View Drop Down
Groupie
Groupie
Avatar

Joined: 14 October 2003
Location: United States
Status: Offline
Points: 37
Post Options Post Options   Thanks (0) Thanks(0)   Quote spikeashlye Quote  Post ReplyReply Direct Link To This Post Topic: Referral Script
    Posted: 16 October 2003 at 1:24am

Hey.

I searched the forum for referral script but didn't find what I was looking for.

I'm putting some banner ads on other websites and want to track who brings me the most referrals, nothing major just something basic. I just wanted to track the number of referrals are sent from each website. I am new to ASP and can't really get down what I need to do, I was thinking:

If I put my add on two websites:

http://www.sample1.com

http://www.sample2.com

I wanted to track which one brought me the most visitors something like...

<a href="http://www.mywebsite.com?ReferID=125"><img src="ss.gif"></a>

as a link, and then I could greate a database table with unique referid's. I would search the database for an existing referid, and then update there count (refer 125 = totalrefers + 1) or if the refer number didn't exist then just abort, or put in a generic field.

I think I could do the database part, but I'm just not sure how to read the referid. I can create the link back to my site which includes the referid like above, but I don't know how to read it, maybe I should direct them to a page like

<a href="http://www.mywebsite.com/refer.asp?ReferID=125"><img src="ss.gif"></a>

Somehow decode that raw string so I can read the refer id, then redirect them to my hope page... if all goes well the user will never see the refer.asp page, unless maybe a quick flick in the browser while they are being redirected.

Does someone know what I'm talking about? If so can you please help thanks.

Back to Top
FLATLINE View Drop Down
Groupie
Groupie
Avatar

Joined: 08 July 2002
Location: Israel
Status: Offline
Points: 142
Post Options Post Options   Thanks (0) Thanks(0)   Quote FLATLINE Quote  Post ReplyReply Direct Link To This Post Posted: 16 October 2003 at 4:44am

Do something like this:

Dim ReferID
Dim sql
Dim rsRefer

ReferID = Request.Querystring("ReferID")
If ReferID <> "" Then
   sql = "SELECT totalrefers FROM tblRefers WHERE ReferID = " & ReferID & ";"
   Set rsRefer = Server.CreateObject("ADODB.Recordset")
   rsRefer.Open sql, ado
   If NOT rsRefer.EOF Then
      rsRefer("totalrefers") = rsRefer("totalrefers") + 1
   End If
   rsRefer.Close
   Set rsRefer = Nothing
End If

 

Just add that script to your homepage and of course modify it for your needs.



Edited by FLATLINE
Visit my site: DarkGreen HQ
Back to Top
spikeashlye View Drop Down
Groupie
Groupie
Avatar

Joined: 14 October 2003
Location: United States
Status: Offline
Points: 37
Post Options Post Options   Thanks (0) Thanks(0)   Quote spikeashlye Quote  Post ReplyReply Direct Link To This Post Posted: 16 October 2003 at 10:46am

That is really cool. You mean I only have to add that to my home page and don't need to have any special links? This way it will track everyone that refers to my website?

Whoa! Nice!

Just one more question, do I just put that anywhere, like in <% %> or do I need to put it in a special function so it knows when to execute? I'm not sure if that will execute every time the page is loaded.

THANKS!!!!!!!!!

Back to Top
FLATLINE View Drop Down
Groupie
Groupie
Avatar

Joined: 08 July 2002
Location: Israel
Status: Offline
Points: 142
Post Options Post Options   Thanks (0) Thanks(0)   Quote FLATLINE Quote  Post ReplyReply Direct Link To This Post Posted: 16 October 2003 at 6:28pm
It will be executed every time when the Querystring("ReferID") is not empty.
Visit my site: DarkGreen HQ
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.