« »
Apr 15
2013

leaking ecommerce funnel

Sometimes, the urls (and titles) of your pages are not conducive to web analytics reporting. For example, your ecommerce site’s payment, shipping, and order confirmation page may all have the same url for some reason – http://www.domain.com/checkout.aspx. To web analytics, all these funnel pages are reported as one page. You are now stuck, you can’t create ecommerce funnels and measuring shopping cart funnel abandonment is impossible. And there is a more subtle and serious issue as well, in your report, you may find hits (events, ecommerce, social, etc) associated with this url, but you won’t know what part of the order process these hits belong to.

checkout.aspx browser bar

Here’s the actual flow we want to track and understand:
ecommerce funnel

If you have a shipping calculator on your shipping page, a card type drop-down on the payment page, social buttons on all pages, you want to track each of these events on each page. However, it will show like this:
events-landing-page-bad-url

All the urls are the same! How do you know if these events happened on the shipping page, payment page or order confirmation page? You might be able to tell from the event names, but in some cases you may not be 100% sure, and this is definitely not clean and ideal.

While fixing the actual real urls and title tags (assigning unique urls and titles per page) would make things very organized, your content management system may not support this, or you might prefer not to spend that time or money on developers.

Luckily, there is a secret, undocumented method that allows you to actually set the page url and title of a visited page in Google Analytics. More importantly, it will actually associate the hits with these new, more meaningful page urls and titles. Your reports will be easier to read and will provide insights that may not have been available before.

The Issue With Virtual Pages

The traditional solution to this would be to use the _trackPageview method and trigger virtual pages for each “step” (i.e. /virtual-page/shipping.html, etc.).

_gaq.push(['_trackPageview', '/new-meaningful-url.html']);

The drawback here though is still, the actual events will not be associated with these virtual pages you’ve created. They will always be connected to the “real” page, which would be /checkout.aspx (as you can see in the screenshot above). You’re still lacking potentially valuable insights.

SECRET HACK! Setting the URL and TITLE in Google Analytics – _set method

With this new _set method, you can manually set the url and title of the page to whatever convenient name you want.

  _gaq.push(['_set', 'page', '/new-meaningful-url.html']);
  _gaq.push(['_set', 'title', 'New Meaningful Title']);

Simply push the new page’s title using _set method before calling your _trackPageview

<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXXX-X']);
_gaq.push(['_setDomainName', 'e-nor.com']);
  _gaq.push(['_set', 'page', '/new-meaningful-url.html']);
  _gaq.push(['_set', 'title', 'New Meaningful Title']);
_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>

pages-google-analytics

In the case of the ecommerce example mentioned earlier, for each page you’d like to rename, you can pass the preferred url and title so that it’s separated and meaningful in Google Analytics and associated WITH THE HITS:

_gaq.push(['_set', 'page', '/shipping.html']);
_gaq.push(['_set', 'title', 'shipping page']);

OR

_gaq.push(['_set', 'page', '/payment.html']);
_gaq.push(['_set', 'title', 'payment page']);

OR

_gaq.push(['_set', 'page', '/confirmation.html']);
_gaq.push(['_set', 'title', 'order confirmation page']);

events landing page good url

You’ll be able to see events and figure out things like “Did they abandon the cart at the payment page? At the shipping page? What are they clicking on the order confirmation page?” etc.

What do you think? Share what other use cases you might have in mind.

Tags: , ,

7 Responses to “Reporting Accurate Funnels in Google Analytics”

  1. Cady Haren says:

    Fantastic information, have never run into issues where I had common goal URLs but this is nevertheless information that I can use when challenges like these come along. Thanks a lot for the tutorial :)

  2. geert moyson says:

    Great article. I my case, i’m dealing with some level of inconsistency in our urls when switching between different stages in the funnel. F.e. actual stage = 3; when you return to stage 2, the url indicates stage 4 :-( quite annoying and unfortunatly, it’s not that easy to resolve… nevertheless, this method helps me to solve the issue. However, i can’t find the _set method in Google’s tracker documentation and searching the web was unsuccesfull. Can you provide more information on this method or paste a link to more information ?

    Thanks in advance
    Geert

  3. Ahmed Awwad says:

    Thanks Cady for reading and for the nice words :)

  4. Ahmed Awwad says:

    Thanks Geert, I’m glad you found it helpful.
    unfortunately _set is undocumented method that’s why you’ll not find it in Google’s tracker documentation.

  5. geert moyson says:

    Thx Ahmed for the feedback.

  6. Interestingly, this begs the question, what else can be custom _set? There are at least 2 additional variables which can be used with _set

    - currencyCode (recently acknowledged by GA in their change log https://developers.google.com/analytics/devguides/collection/gajs/changelog)

    - campaignParams

    There are several others if you go digging through the ga.js but these seem most obvious as to their uses.

    Great discovery Ahmed!

Leave a Reply