Wednesday, January 18, 2012

Track KISSInsights (now Qualaroo) surveys with Google Analytics

[UPDATE - January, 19th 2012] I update the code so it is compatible with all question type.
[UPDATE - January, 25th 2012] I fix two bug. 1) Now the GA event is fire. 2) surveyId extraction is cleaner.
[UPDATE - February, 23th 2012] Added some screenshot from Google Analytics
[UPDATE - August, 16th 2012] More complete code

For a while, I searched a way to track KISSInsights with Google Analytics (GA). I wished to use the GA _trackEvent tag to capture the actual question/answer.
Here the code (using jQuery):
  1. Load Google Analytics. Make sure you use your UA.
  2. Load KISSInsights (now Qualaroo). Make sure you use your survey code.
  3. Check if jQuery is available, if not, load it
  4. Link Qualaroo with Goolge Analytics
Basically, this code is trigger when a user submit his answer. It will create a _trackEvent tag for each question/answer(s) pair. The beauty of the code is that it fetch the actual text value automatically and save it in a readable way into GA.

  • Event category: Always VOC (you can change it to any thing you like.)
  • Event action: The actual survey id (so if you have multiple survey running at the same time, each one would be save separately in GA.)
  • Event label: "Question text | Answer(s) text"
Doing so, I could then create segments and custom reports in Google Analytcs base on that Voice of Customer (VoC) data.
For example:
  • Which traffic source yield better satisfaction?
  • Does satisfaction impact goal completion rate?
  • Does satisfaction impact frequency/recency of visitor?

Here a example on how to create a custom report in Google Analytics to categorize outcome base on survey answer.
And here a example directly from the Google Analytics Events report.
Enjoy and feel free to let me know/share if you like :-)
[UPDATE - January, 20th 2012] You could easily modify the tracking to use an alternate version. Your choice.
if (question && anwser) _gaq.push(['_trackEvent', 'VOC-' + surveyId, question, anwser]);
  • Event category: VOC-surveyID (so if you have multiple survey running at the same time, each one would be save separately in GA.)
  • Event action: Question text
  • Event label: Answer(s) text


16 comments:

Ophir Prusak said...

This is great! I was looking for the same functionality a while back and even contacted kiss metrics about making it easier to latch on the questions.

Can't wait to see some user segmented data :)

Sébastien Brodeur said...

Same for me. :-)

I will surely "extend" that post in the next couple of days to include screen capture from GA showing some use of this data.

Sébastien Brodeur said...

I update the post. Enjoy!

Sébastien Brodeur said...

Just fix two bugs:

1 - Now the GA event will be fire. (sorry for this one.)

2 - The surveyId extraction is cleaner now.

Angelina said...
This comment has been removed by a blog administrator.
Mariusz Szatkowski said...

great! try to use it at contact form 7 wordpress plugin... ;)

Carmen said...

Hi Sebastien,

Thanks so much for this, I've started using it last week but my problem is it seems to only capture a small number of submissions as events (only 11 when I have had over 300 surveys filled). I'm thinking the order of the scripts is important, if not, do you have any idea what could be causing this? Where does this bit get placed? After GA AND KissInsights script?

Thanks

Sébastien Brodeur said...

Yes, it's better to put my code after the GA and KISSInsights codes.

Eli said...

Sébastien,

Thank you very much for making this code public. Can't wait to feed this data into my GA account.

Ariel said...

HI,

Thank you! this is cool.

Any idea how long an answer you can keep in the GA event label?

gymrat said...

tried installing the code,but doesn't seem to work. the code just displays as is when viewing the site.
am i supposed to wrap script tags around this? don't know coding at all. would be great if you can provide instructions. thanks in advance.

Sébastien Brodeur said...

@gymrat: Yes, this code should go in a <script> tag. You could simply put this just after your _gaq.push(['_trackPageview']); and it should work. Good luck

Sébastien Brodeur said...

@Ariel: I believe this could be very long, so I won't worry about it.

gymrat said...

thank you sebastien, but it did not work for me.

i didn't get any errors, just no tracking data in GA. strange.

am i supposed to add a reference to the jquery file or include "$(document).ready(function() {" in the script?

Sébastien Brodeur said...

@gimrat: I update the code in the blog post. You should now have a more complete version of the code. Juste make sure you set you Google Analytics UA number (_setAccount) and make sure you use the KISSInsights/Qualaro script they provide you.

gymrat said...

thanks for making it super easy for people like me. but unfortunately, i tried it but still to no avail. :( i double, triple checked but still not getting it to show up in GA.

i give up and will wait till qualaroo integrates this.

thanks very much again for your help nonetheless.