<% option explicit%> <% ' ---- Define the name of this page for form call backs Dim ThisPageName ThisPageName = "reg_check.asp" ' -- Disable caching and set a 4 minute TimeOut period Response.Expires = 0 Server.ScriptTimeout = 240 ' -- This is the string we will use for SQL commands Dim strSQL ' -- This is the RecordSet we will store results in Dim RS WriteDefaultFont ' --- Set up our connection to the database ' --- (Needs to be Cmd for .INC file) Dim Conn, Cmd Set Conn = GetConnection Conn.CommandTimeout = 180 Set Cmd = GetCommand(Conn) Cmd.CommandTimeout = 180 ' --- Allow us to Report for various registrations ' ---- (NOTE: fDumpPartnerID values must map to radio buttons below) ' ---- For easier mapping we use partner_val values (ie PartA = 1, PartB = 2, etc) const c_AAA_partnerID = 1 const c_BBB_partnerID = 2 const c_CCC_partnerID = 4 const c_DDD_partnerID = 5 const c_EEE_partnerID = 7 const c_FFF_partnerID = 21 dim fDumpPartnerID, sDumpGroup, sDS_value fDumpPartnerID = c_AAA_partnerID ' --- Assume that we want AAA reg sDumpGroup = "AAA Partner" sDS_value = Request("DumpSelect") ' ------------------------- AAA -> AAA reg If (sDS_value = "AAA") then fDumpPartnerID = c_AAA_partnerID sDumpGroup = "AAA Partner" ' ------------------------- BBB -> BBB Partner Reg elseif (sDS_value = "BBB") then fDumpPartnerID = c_BBB_partnerID sDumpGroup = "BBB Partner" ' ------------------------- CCC -> CCCink Reg elseif (sDS_value = "CCC") then fDumpPartnerID = c_CCC_partnerID sDumpGroup = "CCC Partner" ' ------------------------- EEE -> EEE Partner Reg elseif (sDS_value = "EEE") then fDumpPartnerID = c_EEE_partnerID sDumpGroup = "EEE Partner" ' ------------------------- DDD -> DDD Partner Reg elseif (sDS_value = "DDD") then fDumpPartnerID = c_DDD_partnerID sDumpGroup = "DDD Partner" ' ------------------------- FFF -> FFF Partner Reg elseif (sDS_value = "FFF") then fDumpPartnerID = c_FFF_partnerID sDumpGroup = "FFF Partner" end if Dim DEBUG_FLAG DEBUG_FLAG = 0 ' --- Set to 1 to dump SQL string %> Current Day Clicks In Stats <% WriteDefaultFont if sDumpGroup = "AAA Partner" Then Response.write "" elseif sDumpGroup = "BBB Partner" Then Response.write "" else Response.write "" end if %> Current Day Clicks In Stats Page

Page started at: <% = Now %>

To Site Stats Page

To Sales/Marketing Stats Page

<% ' ------------------------------------------------------------------------- ' -- Provide a way of changing the entries shown ... (self referring call) ' -- Make sure the page being called is this one... ' ------------------------------------------------------------------------- %>

Dump Registrations for:   > AAA Partner
  > BBB Partner
  > CCC Partner
  > DDD Partner
  > EEE Partner
  > FFF Partner

<% WriteDefaultFont Dim TheDate, DateParts, FormattedDate DIM AcqID, AcqName, FirstHit, Reg, FirstReg Dim TotalRegistered dim Today dim Start_date, End_date Today = date Start_date = DateAdd("d", 0, Today) End_date = DateAdd("d", 1, Today) TheDate = Now DateParts = Split(TheDate, " ") Today = DateParts(0) FormattedDate = DateConvert (Today) ' --- Get current total registered users strSQL = _ " select count(user_identifier) as REG " & _ " from user_info_table (nolock) " & _ " where partner_val = " & fDumpPartnerID & _ " and date_joined between '" & Start_date & "' " & _ " and '" & End_Date & "' " if DEBUG_FLAG = 1 then response.write strSQL & "

" & VBCRLF else Cmd.CommandText = strSQL Set RS = Cmd.Execute TotalRegistered = RS("REG") RS.Close Set RS = nothing %> Total registrations are <% = TotalRegistered %> for <% = Today %> for <% = sDumpGroup %>
(Note: The number above may not match the number below exactly) <% end if ' --- of DEBUG_FLAG check WriteDefaultFont ' ----- The headers below need to match the WriteTableRow() format %>

<% ' ------- Today's should use first_reg to count new registrations strSQL = _ "select sci.acq_id as CAMPID, " & _ " sca.campaign_name as CAMPNAME, " & _ " sci.first_hit as FIRST_HIT, " & _ " sci.first_reg as REG " & _ " from stat_inval_track sci (nolock), stat_campaigns sca (nolock) " & _ " where stat_date = '" & FormattedDate & "' " & _ " and sci.first_reg > 0 " & _ " and sca.acq_id = sci.acq_id " & _ " and sca.partner_val = " & fDumpPartnerID & _ " order by sci.first_reg desc " if DEBUG_FLAG = 1 then response.write strSQL & "

" & VBCRLF else Cmd.CommandText = strSQL Set RS = Cmd.Execute While not RS.EOF AcqID = RS("CAMPID") AcqName = RS("CAMPNAME") FirstHit = RS("FIRST_HIT") Reg = RS("REG") WriteTableRow AcqID, AcqName, FirstHit, Reg, -1, TotalRegistered RS.MoveNext Response.flush Wend ' -- End of while loop through RS end if ' --- of DEBUG_FLAG check %>

Campaign    Name     Home Page     Registrations     % total Reg     % Home Page  

<% ' -------------------------------------------------------------- ' ------------------ Now show YESTERDAYS reg ------------------- ' -------------------------------------------------------------- Today = date Start_date = DateAdd("d", -1, Today) End_date = DateAdd("d", 0, Today) TheDate = DateAdd("d", -1, Now) ' -- since we want YESTERDAY DateParts = Split(TheDate, " ") Today = DateParts(0) FormattedDate = DateConvert (Today) ' --- Get current total registered users strSQL = _ " select count(user_id) as REG " & _ " from user_info_table (nolock) " & _ " where partner_val = " & fDumpPartnerID & _ " and date_joined between '" & Start_date & "' " & _ " and '" & End_Date & "' " if DEBUG_FLAG = 1 then response.write strSQL & "

" & VBCRLF else Cmd.CommandText = strSQL Set RS = Cmd.Execute TotalRegistered = RS("REG") RS.Close Set RS = nothing %>


Total registrations were <% = TotalRegistered %> for <% = Today %> for <% = sDumpGroup %> <% end if ' --- of DEBUG_FLAG check WriteDefaultFont ' ----- The headers below need to match the WriteTableRow() format %>

<% ' ---- Yesterday's accurate new registrations are stored in daily_reg ' ---- But we want to see what was in the first_reg column as well strSQL = _ "select sci.acq_id as CAMPID, " & _ " sca.campaign_name as CAMPNAME, " & _ " sci.first_hit as FIRST_HIT, " & _ " sci.first_reg as FIRST_REG, " & _ " sci.daily_reg as REG " & _ " from stat_inval_track sci (nolock), stat_campaigns sca (nolock) " & _ " where stat_date = '" & FormattedDate & "' " & _ " and sci.daily_reg > 0 " & _ " and sca.acq_id = sci.acq_id " & _ " and sca.partner_val = " & fDumpPartnerID & _ " order by sci.daily_reg desc " if DEBUG_FLAG = 1 then response.write strSQL & "

" & VBCRLF else Cmd.CommandText = strSQL Set RS = Cmd.Execute While not RS.EOF AcqID = RS("CAMPID") AcqName = RS("CAMPNAME") FirstHit = RS("FIRST_HIT") Reg = RS("REG") FirstReg = RS("FIRST_REG") WriteTableRow AcqID, AcqName, FirstHit, Reg, FirstReg, TotalRegistered RS.MoveNext Response.flush Wend ' -- End of while loop through RS RS.Close Set RS = nothing end if ' --- of DEBUG_FLAG check Conn.Close Set Conn = Nothing %>

Campaign    Name     Home Page     Registrations     % total Reg     % Home Page     (level 3)  

The Registration value for Yesterday is based on what was actually in the user_info_table table. The (level 3) number shows what had been put into stat_inval_track originally. A large discrepancy is normally an indicator that something isn't being recorded correctly on registration.

Page completed at: <% = Now %> <% ' ------------------------------------------------------------------ ' --- This function writes a table row ' --- The format should match the row headers above ' --- If level three not being passed in, then set it to -1 ' ------------------------------------------------------------------ Sub WriteTableRow (iAcqID, sAcqName, iFirstHit, iReg, iFirstReg, Total) Dim fPercent, fPercent_2 If (Total > 0) then fPercent = iReg/Total else fPercent = 0 end if If (FirstHit > 0) then fPercent_2 = iReg/FirstHit else fPercent_2 = 0 end if response.write " " response.write " " & iAcqID & "" response.write " " & sAcqName & "" response.write "" & iFirstHit & "" response.write "" & iReg & "" response.write "" if (fpercent > 0) then response.write FormatPercent (fPercent, 2) else response.write " " end if response.write "" response.write "" if (fpercent_2 > 0) then response.write FormatPercent (fPercent_2, 2) else response.write " " end if response.write "" if (iFirstReg >= 0) then response.write "  (" & Lthree & ")" end if response.write "" End Sub '$History:: reg_today.asp $ ' ' ***************** Version 6 ***************** ' User: Dfandel Date: 2/06/03 Time: 11:29a ' Updated in $/stats_admin/stats_sites ' Fix orderby and add first_reg info for yesterday's numbers ' %>