Referrer Tracking ----------------- * Script which counts click throughs * Store a cookie once someone is referred * Only count first referral * People can register with an e-mail address and display name, get an ID and password * People with e-mail and password can see the stats for that ID * Track what people with a cookie do -- do they download a file? do they register? * Let people change password, display name, e-mail * Give list of display names with most referrers Database -------- Registered users: referrer-id, e-mail, password, display name, referrer-referrer-id, new e-mail, new password Destinations: destination-id, uri, download-p Referrals: tracking-id, registered-id, original destination-id, first download destination-id Scripts ------- /setup?password= if password matches internal password, set up databases /register?email=&name= if either email or name is blank, show form, exit check email doesn't already exist if email exists, say "this e-mail is already registered, e-mail has been sent", send e-mail, and exit make new password, new id store email, id, password if user has cookie, mark cookie as "has user" send e-mail to email with link to login script with email and password show page telling user to read e-mail and exit /login?email=&password= display stats for that e-mail allow settings to be changed if password is valid /stats show the top 10 referrers and other stats /refer?referrer=referrer-id&destination=destination-id: check destination is known. If it isn't, map it to destination 0. does user have cookie? no: create new tracking id, associated with refererr and destination (in original, and download if appropriate). send new cookie with tracking id and redirect to verification yes: this is another referral for someone already referred. if destination is download: update the tracking entry to have this destination-id as the download if there isn't one already. redirect to destination /verify?referrer=referrer-id&user=tracking-id&destination=destination-id check that there is an entry for referred-id, tracking-id, destination-id (as original) check tracking-id matches what the user's cookie says if there is no cookie or if it doesn't match remove the entry in the database redirect to destination