Home > Programming, Servers & Scripts >

How to Store and Analyze Survey Data (21)


09-04-2013 02:31 AM #1 JasperP (Member)
How to Store and Analyze Survey Data

I've gotten a few messages asking about how I gather data for surveys. I posted a sample of data on this thread:

http://stmforum.com/forum/showthread...-Success-Diary

I looked at some old code that I had and coded a simple script for you guys to track your survey data.

This script uses PHP to process the survey and .CSV files to store the data. (See attachment below)

Example #1: survey1.html

survey1.html is your basic bare bones template




Example #2: survey2.html

survey2.html uses jQuery transitions and CSS to style the survey.





survey#.html Note #1
Each group of answers requires 'Q-' prepended in the 'name' tag and requires the same question

Example:

Code:
    <h3>What is your gender?</h3>
    <input type="radio" name="Q-What is your Gender?" value="male">Male<br />
    <input type="radio" name="Q-What is your Gender?" value="female">Female

    <h3>What is your Age?</h3>
    <input type="radio" name="Q-What is your Age?" value="18-21">18-21<br />
    <input type="radio" name="Q-What is your Age?" value="22-25">22-25<br />
    <input type="radio" name="Q-What is your Age?" value="26-30">26-30<br />
    <input type="radio" name="Q-What is your Age?" value="31-35">31-35<br />
    <input type="radio" name="Q-What is your Age?" value="36-40">36-40<br />
    <input type="radio" name="Q-What is your Age?" value="41-45">41-45<br />
    <input type="radio" name="Q-What is your Age?" value="46-50">46-50<br />
    <input type="radio" name="Q-What is your Age?" value="51-55">51-55<br />
    <input type="radio" name="Q-What is your Age?" value="56-60">56-60<br />
    <input type="radio" name="Q-What is your Age?" value="60+">60+<br />

survey#.html Note #2
The 'redirect_url' can be used for your offer link. This is the page your visitor will go to after completing the survey. Change this URL to your own link.

Example:
Code:
<input type="hidden" name="redirect_url" value="http://www.amazon.com/PaleoTrim-Natural-Raspberry-Ketones-African/dp/B009K6ECTU">

survey_submit.php Note #3:
Change the survey_filename to your own unique name.

Code:
$survey_filename = "survey_data_file.csv";
You can download the survey data by going to the path of your survey_filename:
Example: http://www.domain.com/path/to/survey_data_file.csv

After you download your survey file, you can open it in Microsoft Excel, OpenOffice Calc or Google Spreadsheets to view the data. Use pivot tables to organize the data.


09-04-2013 02:32 AM #2 JasperP (Member)

How to use Google Spreadsheets to Analyze Survey Data

This tutorial was done using sample data that I created using the survey script.

Step 1. Open Google Drive and click on "CREATE" then "Spreadsheet"


Step 2. Click on "File" then "Import"


Step 3. Click on Choose File and select your .CSV file. Click Import and then "Open Now >>"


Step 4. In order to create a Pivot Table, click on "Data" then "Pivot Table report ..."


Step 5. Click on "Rows - Add Field" and select "What is your Age?"


Step 6. Click on "Columns - Add Field" and select "How much Weight would you like to lose?"


Step 7. Click on "Values - Add Field" and select "How much Weight would you like to lose?"


Step 8. Under Values, Click on Summary By Sum and select "COUNTA"


Step 9. This is what your data should look like after resizing the columns


*Sample CSV data file included for educational purposes


09-04-2013 06:12 PM #3 john galt (Member)

Thanks a ton for this Jasper, you just opened up a dozen doors that I've been to technically challenged to open.


10-11-2013 10:07 AM #4 raffaello (Member)

Thanks a lot! I have new idea now and I am gonna use it.


10-11-2013 12:22 PM #5 brianb (Member)

Boom! Thanks man this is awesome.


12-19-2013 06:50 PM #6 toneko (Member)

awesome tutorial ,jasperp ! been looking for this for quite a while ! thanks a bunch


12-19-2013 08:49 PM #7 toneko (Member)

btw is there a way to show a div with a running bar and then redirect to another div (q6) ? cheers

EDIT: just figured it out. you should add this-

setTimeout("$('#q5').hide()",3000);
setTimeout("$('#q6').fadeIn()",3000);

And this if you want it to be automatically redirected to the offer page -

<script type="text/javascript">
setTimeout("window.location='url'",3000);
</script>


12-20-2013 12:16 PM #8 toneko (Member)

btw does anyone have a process javascript spinner ? tried spin.js by Felix Gnass, cant seem to work it out thanks !

Update: finally got it to work here's a very detailed description: http://www.jqueryscript.net/loading/...g-Spinner.html


01-10-2014 06:51 AM #9 bravenewworld (Member)

Would this work for lead/email submits? Or only answering questions?


01-10-2014 05:43 PM #10 caurmen (Administrator)

@bravenewworld - How are you envisaging it working with email submits?


01-10-2014 08:44 PM #11 bravenewworld (Member)

Like I would have an email submit on my landing page. Would a database be best for that or really only for surveys like in the example?


01-17-2014 03:18 PM #12 caurmen (Administrator)

In that case you'd probably be best just capturing the email to a mailing list server, I think.


05-09-2014 11:48 AM #13 gettinpie (Member)

Hey guys,

I've followed the survey steps, modified it a bit and it definitely works (when I go through the flow).

However, on my tracker it doesn't show any clicks to the "offer" or the "landing page" of the survey (tested both).

Here's the super strange part. The clicks to the offer (after the survey) are showing up in the ad network. BUT the survey
responses are not showing up when I download the csv.

I've created another banner that directs straight to the survey without going through the tracker and am waiting for
results on this to see if it changes anything.

Any idea what it could be?

Thanks for the help.

Cheers

P.S. The tracker goes through the 'LP' flow using cookie tracking (desktop campaign) and it goes to the offer
after survey completion, so I'm kind of stumped.


05-09-2014 06:12 PM #14 caurmen (Administrator)

When you click through it yourself, are your clicks going into the csv?

Also, have you checked your webserver's error log? Sounds like there's probably a PHP error happening somewhere.


05-09-2014 06:14 PM #15 gettinpie (Member)

Hey Caurmen,

Yeah the clicks are going to the csv, which is why i'm confused.

I haven't checked the error log yet, ill check it soon.

Thanks for the help!


05-09-2014 06:27 PM #16 gettinpie (Member)

Hey Caurmen,

The only error I get in the error log is the following:
[09-May-2014 06:15:59 America/New_York] PHP Warning: Module 'Phar' already loaded in Unknown on line 0

It only showed up 5 times however up until 07:24:09. The traffic has been running until about an hour ago (13:00 New York Time).

Any ideas?

Thanks

To clarify, my survey results ARE showing up in the CSV, but the visitor's are not.


05-10-2014 04:14 AM #17 zeno (Administrator)

How is the cookie tracking set up? Could it be an error here, i.e. no cookie = broken survey. You are cookied = survey works fine?


05-10-2014 10:45 AM #18 gettinpie (Member)

Hey,

OK. So I did the test direct to the survey without going through the tracker and
the survey results are in!

Fuck ya! Though for some reason it's no longer 10% of the visitors going to the
offer. Super strange...

Thanks for the help guys

Cheers


05-10-2014 11:19 AM #19 caurmen (Administrator)

That error's unlikely to be causing the problem.

Frankly, I'm a bit stumped on this one. Could they simply not be filling out the survey data? Try adding a pre-filled field to the form and see if that gets recorded in the CSV.


05-10-2014 01:08 PM #20 gettinpie (Member)

Hey Caurmen,

So am I, it makes no sense!

I've tested it without a tracker (direct linked to survey) and have gotten 30 fill outs so far, so they
are definitely doing the survey.

The strange part is that when using the tracker instead of direct linked I got around 10% click-throughs
to the offer (only way to arrive there is filling out the survey), direct linked it's closer to 1%.

The thing that really boggles my mind is the tracker wasn't showing clicks to the survey when I set
it up as a landing page OR as an 'offer'.

Cheers

EDIT: I'm using Imobitrax as my tracker of choice.


05-12-2014 01:14 PM #21 caurmen (Administrator)

Hmm.

If you want to spend a bit of money you could probably bug fix this.

Get some people on Fiverr or Mechanical Turk to go through the survey with you on Skype at the same time. Watch what they see and what they do. Look at the CSV live.

That should give you some more ideas of the problem.


Home > Programming, Servers & Scripts >