Google analytics funnels goals events

Note 02 28 2014: This article shows syntax for both the old deprecated way using ga.js and also the new recommended way, using analytics.js. The old way will still work for awhile. This following link shows how to convert old code to new code https://developers.google.com/analytics/devguides/collection/upgrade/reference/gajs-analyticsjs

Note 02 05 2014: The Google Analytics Debugger seems helpful although I've never used it: https://chrome.google.com/webstore/detail/google-analytics-debugger/jnkmfdileelhofjcijamephohjechhna?hl=en

You can use events as goals. However, to create funnels you must use pageviews. On pages where we use javascript to refresh the page and the URL doesn't change, it seems like it's impossible to create funnels. But, you can do it by triggering virtual pageviews. This is the recommended way to do it, even according to Google's own documentation.

So, for example, on a recent site I worked on, there is a form that visitors fill out to see if they qualify for a free diabetes testing meter. On the form, there are four steps that make up our Google Analytics funnel:

  1. Visit the form at the URI /offers
  2. Proceed to step 2 of the form by clicking the next button, the view changes with javascript
  3. Proceed to step 3 of the form by clicking the next button, the view changes with javascript
  4. Proceed to the page at the URI /offers-thankyou (This is our goal)

Only the first and fourth steps have URIs. So, for steps two and three, we will have to use virtual pageviews. To trigger a virtual pageview, just use the regular GA page tracking code but reference a fake page. For example, here are two snippets that will trigger virtual pageviews for Steps 2 and 3 (using async tracking):

New way, using analytics.js:
ga('send', 'pageview', '/free-meter-offer/step-2.php');
ga('send', 'pageview', '/free-meter-offer/step-3.php');
Deprecated way, using ga.js:
_gaq.push(['_trackPageview', '/free-meter-offer/step-2.php']);
_gaq.push(['_trackPageview', '/free-meter-offer/step-3.php']);

The URL of the virtual page must have an extension or it may not work.

This URL works:
/free-meter-offer/step-3.php

This URI may not work:
/free-meter-offer/step-3

Article Type

General