Have Questions? (800) 477-0970

Google + SurveyGizmo, Part 2: Integration

Posted by 6 Responses Filed in: How-to articles, SurveyGizmo News

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">//
  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">
  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:

Have you tried SurveyGizmo yet? Try our 14 day free trial

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.


Responses
RSS feed for comments on this post.  •  TrackBack URI

  1. 1

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

    Trevor on Sat, Nov 24 ’07 at 2:55 pm #
  2. 2

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

    Nils on Tue, Feb 19 ’08 at 6:28 pm #
  3. 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!

    Simon Cox on Mon, Jun 09 ’08 at 8:20 am #
  4. 4

    Pingback

    [...] 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. [...]

  5. 5

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

    Greg B on Tue, Jan 04 ’11 at 9:57 am #
  6. 6

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

    brittany on Tue, Jan 04 ’11 at 12:46 pm #

Respond.


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) 477-0970.

No credit card required.

  • Call us at (800) 477-0970
    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.

The Survey Expert Blog

By

Why Survey Design Matters for Feedback Surveys

February 3 2012 -

Survey Expert Ryan Farmer observes that many well-known companies aren’t branding their surveys, and discusses why survey design is hyper-important when you want to gather customer feedback.

By

New Team Management & User Permissions System

Starting February 2nd, SurveyGizmo is launching a new set of user management features. Learn more about them here!

By

5 Questions with SurveyGizmo co-founder and CEO Christian Vanek

Boulder’s Daily Camera newspaper interviews Christian Vanek, who shares what’s next for the company.

More from our Survey Experts