Page 1 of 1

Adding referral survey data to database

Posted: Fri May 06, 2011 12:58 pm
by mouse_8b
Hello,
My company has made a big marketing push recently and we would like to know what is and isn't working. We figured putting a "Where did you find us" question on the checkout page would be a pretty good metric. However, I'm not exactly sure how to make it work correctly.

Things I know need to be done:
  • Create a table in the database to record answers
    Put an ASP select box on OPC
    Modify .cs file to record survey data to database
To create the table, I figure I just need to make an aspx page that will run this SQL code, but I don't know what C# methods to send this query to:

Code: Select all

CREATE TABLE SurveyData{
	NoAnswer int,	LongTimeCust int,	SearchEngine int,	GoogleAd int,	TV int,	Radio int,	Newspaper int,	Friend int}
This is my select box to go in OnePageCheckout.aspx. Am I right in thinking this (plus a prompt) is all that needs to be added OPC.aspx?

Code: Select all

<select id="selSurvey" runat="server">
	<option value="No">No Answer</option>
	<option value="LongTime">I am a long time customer</option>
	<option value="Search">Search Engine</option>
	<option value="GoogleAd">Google Ad</option>
	<option value="TV">TV Commercial</option>
	<option value="Radio">Radio Commercial</option>
	<option value="Newspaper">Newspaper Ad</option>
	<option value="Friend">From a Friend</option>
</select>
In OnePageCheckout.aspx.cs, I think I need to add to the CheckedOut() method. I know that "selSurvey.Value" is the data I'm looking for and I can use a switch statement to figure out which database entry to increment, but I don't know how to write that to the database.

I have some experience with using PHP to query mySQl databases, but no experience with using .NET languages to query MSSQL databases.

Am I on the right track? Is there a better way to do this? It looks like AC or .NET has some methods that make database access easier, but I'm not sure how to use them. Any help is appreciated.

Re: Adding referral survey data to database

Posted: Mon May 09, 2011 8:06 am
by jmestep
We have done it without a new table by creating an entry in the ac_CustomFields table with the orderid being the key to match on.