Google + SurveyGizmo, Part 2: Integration
Two weeks ago we wrote a post describing how to pass information into SurveyGizmo from Google Adwords. Very nifty! *This week* we are going to pass information from SurveyGizmo into Google Analytics. Even niftier, huh?
Why would we want to do this? Well, Google Analytics is a very powerful (and free) web analytics suite. With it you can track survey conversions, path analysis, sources of surveys traffic and even various versions of your forms and surveys. It’s the best of both worlds.
So let’s get the ball rolling:
Introduction to Google Integration Code
When you create a Google Analytics account you are given code snippets and instructed to place them at the bottom of each page on your website. For use in surveys, you will need to add them to the HTML Template of your Survey’s Theme.
There are two parts of the code you are asked to embed: 1) A javascript library that Google provides and 2) a little snippet of javascript code that actually triggers the analytics record.
The first part looks like this:
<script type="text/javascript"> var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); </script>
You should place this bit of code at the top of your survey’s HTML template (the very top).
The second part looks like:
<script type="text/javascript"> var pageTracker = _gat._getTracker("YOUR GA CODE"); pageTracker._trackPageview(); </script>
So, where does this part go? Well, first we are going to modify this bit just a little. Why? Because we want to track individual survey pages, and make them a bit easier to understand in Google Analytics.
So, here is what we are going to do. We are going to pass an argument (a bit of data) to the urchinTracker function that will identify individual pages of the survey. We are also going to create a “fake” folder for our survey. So change this second bit of code to:
<script type="text/javascript"> var pageTracker = _gat._getTracker("YOUR GA CODE"); pageTracker._trackPageview(/surveys/surveyname/page[%%:Survey_Page%%].html); </script>
You should replace “surveyname” for every survey you integrate. Make it distinct and understandable. The merge code [%%:Survey_Page%%] will merge in the current page number. Tip: If you want to get fancier you can merge in the value of a hidden question on the page, or even question data from previous pages this way.
Place this modified code at the very bottom of the HTML Template.
Congratulations. When you launch your survey, it will store the navigation and traffic information to your Google Analytics account!
From here you can treat your “surveys” folder like it was just another part of your website. You can run your favorite reports, build charts graphs, etc. Enjoy!
Next week we will look into test variations of your surveys and landing pages and doing analysis in Google Analytics.
**This has been updated with the new Google Analytics code.
Tags: google analytics, survey analytics, Survey Integration


1
Is there a list or page containing the syntax for passing information from Gizmo to Google?
2
How about connecting Google Analytics data with the survey data. Is it possible to match this data?
3
Great to see you have been thinking about the things we like to do! However Google have an updated code fragment to use - can you update your code sample to use this.
I was not able to find the next part of your series - “Next week we will look into test variations of your surveys and landing pages and doing analysis in Google Analytics.” - a piece on setting goals and analysing what is happening would be good - also how to reduce abandonment rates!
4
[...] If you use Google Analytics to track your website traffic, you can track survey traffic directly in your Google Analytics account as if the surveys were pages in your website. You can tell where they originated from, how long they spent on your site and even track a conversion all by inserting your Google Analytics code into the survey template. Check out the example here. [...]