Have Questions? (800) 609-6480

Integrating Google Analytics With Your SurveyGizmo Surveys

Posted by 6 Responses Filed in: Features

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.

The code should looks like this:

<script type="text/javascript">// <![CDATA[
//
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'YOUR GA CODE']);
  _gaq.push(['_trackPageview']);
 
  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); 
}
// ]]></script>

You should place this bit of code at the top of your survey’s HTML template (the very top).

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. You will need to change two lines of the above code, one to add your GA Code, and another to reference a page in the survey. When finished with the changes, your whole code will look like this:

<script type="text/javascript">// <![CDATA[
  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'YOUR GA CODE']);
  _gaq.push(['_trackPageview', '/surveys/surveyname/page[template("currentpagenumber")].html']);
 
  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
}
// ]]></script>

*Note – This has code has been updated to work with SurveyGizmo 3.0 surveys which use a new merge code system. If you are using a SurveyGizmo 2.0 survey, you’ll want to insert [%%:Survey_Page%%] instead of [template("currentpagenumber")] in order to track page numbers.

You should replace “surveyname” for every survey you integrate. Make it distinct and understandable. The merge code [template("currentpagenumber")] 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.

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: , ,

Share this:

  • http://www.redcanary.ca Trevor

    Is there a list or page containing the syntax for passing information from Gizmo to Google?

  • Nils

    How about connecting Google Analytics data with the survey data. Is it possible to match this data?

  • http://www.artscapeonline.com Simon Cox

    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!

  • Pingback: Kudzu Business Success Center - 11 Ways Small Businesses Can Use Surveys for Online Marketing

  • Greg B

    Will this code work when using an iFrame on our site for the SurveyGizmo form?

    • http://www.surveygizmo.com brittany

      Hi Greg,
      This should work with the iFrame method. But when it comes to analytics, we always suggest testing it out first.
      Cheers!
      Brittany

About the Author

Christian Vanek
Christian is the CEO and co-founder of SurveyGizmo. Before building SurveyGizmo 1.0, he came from an 11-year consulting background focusing on marketing and content management tools. When not working on new ways to gather data, he spends time developing games and actively supports innovative youth education programs. In spite of living in Boulder, he does not ski.

Start your free 14 day trial

Get all features for $50/month. Add users for $20/month each.

Questions? Call us anytime during your trial at (800) 609-6480 ext 1.

No credit card required.

  • (800) 609-6480 ext 1
    for help setting up larger teams.

* Extra users are free for the duration of your trial.
You can change the number before upgrading to a paid plan.

Best of SurveyGizmo Weekly

By . In Know How.

Likert Scale – What is it? When to Use it? How to Analyze it?

April 24 2012 -

In all likelihood, you have used a Likert scale (or something you’ve called a Likert scale) in a survey before. It might surprise you to learn that Likert scales are a very specific format and what you have been calling Likert may not be. Not to worry — researchers that have been doing surveys for… Read More »

By . In Interviews.

How One Company Beat All Odds in Conducting An Offline Survey In Africa

World-Wize Surveys used the SurveyGizmo API to build their own iPad survey app. Want to know how? Read on.

By . In Best Practices.

How to Get A Raise By Creating Surveys You Can Act On

The most successful survey creators know that creating a survey starts with a solid plan, before you even begin building your survey.

More from our Survey Experts