May 26, 2009

Goal & Funnel Setup Guide in Google Analytics

Working in a Google Analytics Authorised Consultants (GAAC) accredited company and also having a Google Analytics Individual Qualification (GAIQ), it is essential that I master the art of setting up goals and funnels in Google Analytics for our clients.

A goal can be a very important metric for a client to track such as sales, newsletter sign-ups, and registrations. Of course goals are not just limited to those but can be extended to whatever you would define as an important action on the website to track. Not only is tracking important, but it is also vital that you gain insight into what’s going on in the goal process from funnels.

A funnel is a visual representation of what’s happening during each step of your goal. It gives you great insights into the drop off rates of each step so that you can make informed decisions on improving your goal process and landing pages to increase conversion rates. You can accurately pinpoint which step of the goal process are you getting high drop off rates.

This can help you identify problems such as the checkout button not working, too many call to actions that lead to other goals, not best practice usability and so on.

Identify

First of all, you need to identify what goal you’re wanting to track. Make sure you identify each individual step of the goal conversion process. You will also need to identify the ‘conversion page’ – the page where the goal can be counted as a conversion. This is usually the thank you or confirmation page.

Write out the goal steps in a logical way that will help you understand the entire process.

Google Analytics has a maximum of 10 steps – but seriously, if you have a goal that has more than 10 steps, you might want to rethink the goal process.

Scope

Once you’ve identified the goal steps, you will need to scope out the URLs of each step. Are they static or dynamic URLs?

If they are dynamic URLs, you may need to use virtual page views to simplify the tracking process without having to use complicated regular expressions (regex).

An example of using a virtual page view in Google Analytics would be,


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"));

try {
var pageTracker = _gat._getTracker("UA-xxxxxxx-y");
pageTracker._trackPageview('/step1.html'); // change the parameter to the unique logical goal step
} catch(err) {}


If you use the default pageTracker._trackPageview(), Google Analytics will use whatever request URI it sees in the address bar.

You will also need to find out whether this goal process requires cross/sub-domain tracking.

Dollar

Unlike tracking e-commerce transactions that have dynamic values, goal values are static. You will need to figure out whether the goal has a dollar value or not to it.

For example, if I upsell/cross-sell products to my internal newsletter database and I get an average sale of $5, then I would define my newsletter subscription goal value to be$5.

Another example would be if a converted lead is worth $1000 and you have an average 5% offline conversion rate, then your goal value would be$50.

Match Types

You will need to determine what kind of match types should Google Analytics use when matching against the content report. Google Analytics has 3 kinds of match types: head, exact and regular expression.

• Head Match – does not use regex and matches the ‘head’ section of the request URI.

E.g. If you want to match www.dannytalk.com/step1.html?id=123 and www.dannytalk.com/step1.html?id=321, then you would use /step1.html. Identify the common factor.

• Exact Match – uses regex and is not suitable for dynamic URLs.

E.g. If you want to match www.dannytalk.com/step1.html, then you would use ^/step1\.html$as the regex. • Regular Expression Match – as the name says it, uses regex. Handy if you have more complicated matching requirements. E.g. If you want to match www.dannytalk.com/step1.html?source=google or www.dannytalk.com/step1.html?source=yahoo, then you would use ^/step1.html\?source=(google|yahoo). Therefore, it is important to plan and define the entire goal step process prior to implementing the goal so that you can determine which match type will work for you. Putting It All Together Wait wait! Before you do this, make sure you create an additional test profile to your main profile to test your goal to ensure it is working correctly. The reason for this is that once data is recorded in a profile, there’s no way to delete it. Yes you can filter the dates but that can be a hassle as you’d have to remember dates. I will write a profile step guide later on. So once you’ve set up your test profile, go ahead in creating your goal. The checkbox ‘required step’ informs Google Analytics to only record the goal if the visitor has been through step 1 which means they have to go through step 1 in order to be counted as a goal. Goal Funnels Assuming you’ve setup your goal correctly, this is an example of how a goal funnel can look like. Obviously I did not check the ‘required step’ checkbox and that’s why you’re seeing entrance paths at different goal steps – not just step 1. You can see the entrance points, exit points and the drop off rate at each step of the goal. This will help you gain insight as to where the drop offs are occuring and to where they’re dropping off to. Exit pages are the pages where the visitor exited to (internal pages) from the goal path and did not convert within that session. The exit page called (exit) is where the visitor left the site or closed the browser. Note that a visitor does not necessarily have to go through the goal path in sequence to be considered a goal conversion. Essentially, if the visitor somehow skips certain steps and ends up in the thank you page, then Google Analytics will back fill the skipped goal steps. Another thing to remember is that if within the same session a visitor converts the same goal more than once, it will only be counted once (unique per session). Once you’re satisfied that the goal is working correctly, you can implement it in the main profile. Debugging Things to look out for: • Check the content reports to ensure that Google Analytics is tracking the URLs properly. If your goal step URLs aren’t there, it means Google Analytics can’t see it and therefore, can’t match it. • Once again, sub-domain/cross-domain tracking. We want to maintain the same session and not create new ones. • Test your regular expressions to make sure they match correctly. I like using an online regex tool to help me check if my regex is working or not. If you find this guide helpful, consider linking to it and sharing it around :) Feedback and comments would be appreciated. 9 Comments • I have set up a goal which has a static URL /student/purchaseconfirmation but each step in my funnel has a dynamic URL. For example: One of the pages has the following URL: /index/document/id/21567 where everything else remains the same except the last digits i.e. 21567. I need to set up a funnel that can track these pages with dynamic URL’s but I am unsure if I should use this format: /index/document/id/=[0-9].+ or is there any other format that I should use. I have my match type set as “Head Match” but I am not sure if this is going to work. Also do I need to change the tracking code? I appreciate the help. Thanks in advance. • Hi Dai, No you don’t need to change the tracking code. In order to test whether your regex will match your URL, you can just use any online regex tester. I personally use http://gskinner.com/RegExr/. Your regex won’t work (testing it in gskinner). There many ways to do regex matching so something like ^/index/document/id/[0-9]+$ or ^/index/document/id/\d+$would work. You will need to change the match type to regular expression. However, if you change your match type, you will also need to consider your goal URL, which can be change to ^/student/purchaseconfirmation$.

Also if you’re not sure if it’s going to work, well try it out first and see what happens. If it doesn’t work, find out why and then refine and test again. You never know if you don’t give it a go :)

• Our site has lots of pages of this type of format

Each of these types of pages display different hotel information. Uses are landing to our sites from these types of pages. After viewing hotel information, the users is able to book and all are redirected to one thank you page eg http://www.mysite.com/thankyou.html

Now, i was setting up goals and funnels and i am not sure i did it correctly..this is what i did

Goal URL – thankyou.html (Head Match Option)

I was trying to set up the funnel and got confused a bit. Is it correct if i insert a funnel as:-

/hotels/hotel.html

or should it be

/hotels/hotel.html? (including the querystring)

coz the variable that changes is the hotelname

• Are you trying to record hotelname1, hotelname2, hotelname3 as different steps (i.e. step 1, 2, 3, 4 (thank you)) or are you trying to record it all as 1 step (i.e. step 1, 2 (thank you))?

My assumption is you’re wanting to track these as 2 steps with a generic goal of hotel bookings. Using both /hotels/hotel.html and /hotels/hotels.html? should work fine with head match but I would use the ? option if you want to exclude /hotels/hotels.html (if this is a valid page).

Easiest way to test this is to go to your content reports and use the filter at the bottom to see what content pages will it match against. Make sure you escape the ? by doing /? since the filter uses regular expression. Give it a go and let me know how it goes.

• Are you sure you are escaping all characters properly? Shouldn’t the period have a backslash before it and shouldn’t the question mark have one before it too, and not a forward slash?

• Hey Scott

I believe escaping characters is only necessarily when you’re doing a regular expression match. It’s been a while now, but I vaguely recall that the head match is a text match, not regex. Unfortunately Google doesn’t explain this very clearly.

• Thanks to your article I’ve setup a Goal to track the subscription to my newsletter.
Unfortunately the goals aren’t recorded (even if the subscribers flow in).
I checked in analytics and the urls are coorectly there.

The funnel is made up of 3 steps:
1. /newsletter/ the page with the subscription form (marked as required step)
2. /newsletter-grazie/ the page with the “thank you” message. It tells tha user that he will receive an email with the confirmation link to opt-in to the newsletter
3. /newsletter-attivata/ the Goal page. The user land here from the confirmation link he received via email.

Can you help me to anderstand WHY the goals arent recorded?
Maybe because of the “confirmation email”? and if it’s the case haw can handle it?

Thanks for your help and for your wonderful site!
Stefano

• Stefano: Step 1 & 2 are considered to be 1 session and step 3 is considered to be another session since it is coming from an email. In order to record the goal correctly, they must all be within the same session since step 1 is compulsory.

A suggestion for this would be to keep the goal to step 1 & 2 only so that you record the opt-in goal by itself. Then create another goal for step 3 which tells you how many of the opt-in people verified their confirmation email.

• Excellent article – I really appreciate your knowledge about SEO and web development, I have bookmarked it for later viewing and forwarded it on.