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 – . 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.
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:
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.).
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…
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']);
_gaq.push(['_set', 'page', '/payment.html']); _gaq.push(['_set', 'title', 'payment page']);
_gaq.push(['_set', 'page', '/confirmation.html']); _gaq.push(['_set', 'title', 'order confirmation page']);
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.