Google analytics done right: successful business analytics

Google analytics done right: successful business analytics

Piece of Cake

The basics

If you run an online business you should take analytics very seriously. Improving sales, conversions and any other objectives your web application has is an iterative process that needs to be based on measurable and meaningful indicators.

Google Analytics is the most widely used tool to track user data and interactions with your web application, but if you don't have a clear strategy on what you expect and what you are going to do with this data you will easily see yourself failing to extract any value from the overwhelming amount of data that GA collects by default.

If your current digital presence provider is just "enabling" analytics for you - relying on the fact that GA captures a lot of data out-of-the-box - you are wasting your time because:

  • It is difficult - and sometimes not possible - to map the default collected data with the specific processes and interactions on your web application.
  • Although it might be "fun" to track page views, visitors and other global indicators, if you are not integrating this into a defined strategy with objectives it will be useless.
  • Conversions - something that you will always want to track in an e-commerce - do not work out of the box. Avoid "url based" conversion tracking or "configurable" conversion tracking through GA. Conversions should be always reported to GA with laser precision from within your application. Stay away from conversions measured through "thank you pages" and anything similar.

Although GA can get extremely complex, there are some basic steps you can take to ensure that you are at least extracting some real value from this tool:

  • Identify what are the key processes/interactions in your web application. Group them conceptually (i.e. the different pages during a checkout process are all part of the checkout process). Of course, this includes regular conversions (a sale, a subscription, etc..) but can also be extended to processes the user has to go through before performing the conversion and other non-conversion related stuff but that is related to global goals such as improve engagement, reduce bounces, etc.
  • Define meaningful indicators for this processes, when possible choose indicators or groups of indicators that answer a specific question and that can point to potential areas of improvement.
  • Ask your digital provider to track this data as GA events. No excuses here. Everything can be tracked, both from server side and client side with a couple of lines of code. Even e-mail views and opens (for example from autoresponders in your application) can be tracked as conversions or GA events
  • Track this information for a reasonable period of time, no need to seek for statisticall significance here, just use your common sense.
  • Go through the data to detect areas of improvement. If needed, define new indicators to expose an area or opportunity or collect additional data that will allow you to propose improvements.
  • Make your changes.
  • Wait.
  • Repeat.

Besides tracking specific events, you should always

  • Track conversions (sales, subscriptions, etc.)
  • Ensure that your web application is properly managing the User Id functionality of GA. The User Id funcionality allows google to track everything a visitor has done on a site, or even accross devices if you have an authentication system in place. Imagine that you could open a sale on your e-commerce, retrieve the UserId, go to the GA panel and see exactly everything that customer did prior to the purchase (how many visits, how many time, what pages, etc.). This is what the User Id is for.
  • If you are spending money on Google Adwords make sure that you are perfectly propagating conversion values to GA. If you can't perfectly mesure the ROI of what is being spent in Adwords you are throwing money away. Adwords now allows you to use any event from GA to track conversion values. 

Tools for doing this in Drupal

From a technical point of view you need the following to support the above strategies:

  • Embed the GA tracking script
  • Track client side events
  • Track server side events
  • Manage the lifetime of the UserId and integrate it with your application

Embed the GA tracking script

The first thing you need to do is to add the GA tracking script to your application. You can do so with the Google Analytics Drupal module or embed the script programatically. If you use the module there some tweaks you can do and some extended tracking you can setup.

Track client side events

There's the Google Analytics Event Tracking Drupal module that let's you define jquery selectors on a server side hook that will trigger GA events on the client side. This might be a good starting point, but as soon as you want to track interactions that cannot be declared through a selector (for example scrolled to end of page, or hovered over an area) or a combination of interactions, you should go manual. Don't worry, this is super easy.

To trigger an event client side just use this sample code:

ga('send', {
          'hitType': event.hit_type,
          'eventCategory': event.event_category,
          'eventAction': event.event_action,
          'eventLabel': event.event_label,
          'eventValue': event.event_value

This is just a sample, you need to decide when to fire the event and consider situations such as an event being fired twice for the same user. You can do whatever you want here with some code.

Track server side events

The Google Analytic Events Drupal module exposes a small API that will let you trigger GA events during the execution of server side code. These events are sent to the client via Javascript on both page loads and Ajax calls.

Use the following code to trigger an event:

          (new \Drupal\google_analytics_events\Event())

Manage the lifetime of the UserId and integrate it with your application

This one is a little more tough to implement as you need to make some operational decisions that depend the nature of your web application.

For example, if you have a 100% anonymous checkout e-commerce where users never log-in (those exist and work quite well if properly crafted) you can manage the lifetime of the UserId using client side cookies, and then store this data server side to match a UserId with whatever you use to store conversions (i.e. a sale).

Here are Google's guidelines to implement this feature:


Add new comment

By: root Sunday, May 22, 2016 - 11:25