{{ searchResult.published_at | date:'d MMMM yyyy' }}

Loading ...
Loading ...

Enter a search term such as “mobile analytics” or browse our content using the filters above.

No_results

That’s not only a poor Scrabble score but we also couldn’t find any results matching “”.
Check your spelling or try broadening your search.

Logo_distressed

Sorry about this, there is a problem with our search at the moment.
Please try again later.

Understanding purchase latency, the number of days between purchase events, is essential to any customer retention strategy.

If you know how typical customers behave you can identify those who are likely to defect when they don't purchase again within the average latency period, using so-called trip wire events.

If you can re-engage customers before they defect, you'll retain them longer and your revenues will rise.

By monitoring latency for each stage of the customer lifecycle and using intelligent marketing to reduce latency levels you can encourage customers to return more frequently. Since it's almost always cheaper to retain existing customers than it is to acquire new ones so you'll end up with more customers, a higher turnover and more profit.

Latency analysis

Google Analytics provides some related metrics, such as recency and loyalty, but it doesn't measure latency out-of-the-box.

If it's done at all, latency analysis would normally be undertaken using a CRM or custom application. However, it is possible to hack GA to allow it to be used to measure and analyse latency and it's actually fairly straightforward.

While you won't be able to identify individual defecting customers in Google Analytics, as you would with a CRM, you will be able to do some sophisticated latency analysis, allowing you to build a detailed picture of how often customers in different segments are using your services.

Since Google Analytics has such powerful segmentation tools built-in, you may even be able to undertake a more detailed analysis of purchase latency in GA than in any other tool you have available.

How it's done

Step 1: Find your GA e-commerce tracking code

If you're running an e-commerce site and use Google Analytics, you'll be generating the _addTrans and _addItem code with a server-side language like PHP.

This code is triggered on the payment confirmation page and queries the database to obtain the details on the successful transaction that's just been processed for the customer.

 

By populating the _addTrans and _addItem code in your GA tracking tag, the script sends the transactional data back to the Google Analytics server so the purchase details get added to the e-commerce section of your GA profile. 

The hack we're adding runs at the same point and consists of just a couple of simple SQL queries, a bit of PHP and a couple of lines of JavaScript. It's simple but really useful.

Step 2: Calculate the total number of orders the customer has made

When the user reaches the checkout confirmation page you'll need to run a snippet of server-side code to query the database and find out how many previous orders they've made.

How this will be done will depend on the platform you're using, but basically you just need to perform a SQL COUNT() against the database for the customer's ID to determine how many orders they've made in total. 

Step 2: Calculate the purchase latency

If the customer has made more than one purchase they will have a purchase latency value for the given stage in the customer lifecycle. To calculate this you'll need to query the database again to obtain the date of their penultimate purchase. 

You can find the date of their penultimate purchase by using the LIMIT feature of SQL and using the value 2,1 and ordering by descending order ID, for example, "SELECT order_date FROM purchases WHERE customer_id = '1234' ORDER BY order_id DESC LIMIT 2,1". 

Once you've got the date, you can calculate the number of days that have passed between their penultimate purchase date and the date today using a date diff function, resulting in their latency for this purchase event.

Step 3: Track lifetime orders in Google Analytics

You can track the total number of lifetime orders for each customer by adding a single extra line of code. 

_gaq.push(['_trackEvent','Lifetime orders','12 orders','',12]);

For each customer, we'll query the database to record the number of orders they've made using event tracking when they reach the payment confirmation page.

The number of orders is added to the event value field, which will allow GA to calculate averages.

Step 4: Track purchase latency

To determine the latency - the number of days between the current order and the previous one - you'll need to get the total number of orders and subtract one. This will allow you to define which time period you're recording.

For example, if a customer has made four orders in total, and they placed their previous order 45 days ago, we'll record their order 3-4 latency as 45 days using this code.

_gaq.push(['_trackEvent','Latency','Order 3-4','45 days',45]);

For each transaction, the code will check the database to determine the purchase latency for each transaction and send the data to GA. The number of days is added to the event value, allowing GA to calculate the average for each purchase event in the customer lifecycle, building the typical latency table used in database marketing.

Step 5: Examining latency data

Since we've used event tracking you'll find the data in Google Analytics under Content > Event Tracking > Categories > Latency.

Once this code has been running for a while you'll build up a detailed picture of how many orders customers make, what the average is, and how long they wait before purchasing again. You'll end up with a latency table a bit like this.

Only some of the data are relevant (since we're essentially hacking GA to get it to calculate some things for us). Ignore the total events, unique events and event value columns, which don't really hold data that's of any use.

The Avg. Value column shows the average latency for each lifecycle stage, such as Order 1-2 with a latency of 30.43 days, while the Avg. Value field on the main bar shows the site average latency, which is 45 days.

If you click the E-commerce tab you may find that these metrics also differ for each stage in the lifecycle. The pie chart option is also handy for visualising latency levels across the customer base.

You'll probably see that the latency differs for each order made, which shows you differences in customer buying behaviour depending on where they are in the customer lifecycle.

Step 6: Examining lifetime orders data

The Lifetime orders event category will give you a breakdown of the numbers of orders each of your customers have made, how much they spent and what the averages were.

Again, the pie chart option gives a nice visualisation of how customers behave, and you can drill-down further using the e-commerce tab or combining advanced segments to see how sub-sets of the customer-base differ in behaviour. 

Using the data

Look for anomalies.

Examine your latency table and you should see that latencies differ for each stage in your customer lifecycle.

The latencies recorded are averages for your whole site, but they're useful in identifying overall trends.

For each stage in the lifecycle, any customer who fails to return and make a purchase after the average number of days is becoming likely to not return. Use your CRM to identify these customers and target them.

If you're using a discount or offer to re-engage them, sending it just before they're likely to defect is going to give you the best bang for your buck.

When is a customer still a customer? If you can determine which ones have a latency which is greater than the average by a statistically significant level you've come up with a way of finding the answer.

Averages lie, so use segmentation.

While the averages are useful, it's worthwhile also making use of GA's advanced segments. If you sell a wide range of different products, chances are the customers who buy them will have different latencies.

If you sell fast-moving consumer goods you're likely to see shorter latencies than if you sell slower moving items, like shoes or clothes or expensive infrequently purchased items that last a long time.

Matt Clarke

Published 9 August, 2011 by Matt Clarke

Matt Clarke is E-commerce Manager at Swell Uk and a contributor to Econsultancy. Follow him on Twitter , Google + or connect via LinkedIn

5 more posts from this author

Comments (3)

Andrew Steel

Andrew Steel, Business Development Manager at Objective Associates Limited

Good article Matt. While it can be a little messy sometimes, I find it is always good to be able to analyse as much data as you can (and is sensible to do so) in one place.

almost 5 years ago

Peter O'Neill

Peter O'Neill, Founder & Lead Consultant at L3 Analytics

Hi Matt,

Great suggestions for getting more useful information out of Google Analytics. I proposed something similar a couple of months ago without going into this level of detail. But instead of capturing this order history information when someone makes a purchase, I recommended getting it when they login to the site.

My approach was to use event tracking populating the fields as follows:
* Category - Login
* Action - Method used (create account, login, persistent login)
* Label - Number of previous orders
* Value - Total revenue generated by customer

The full post can be found at http://bit.ly/onRsL6.

Cheers

Peter

almost 5 years ago

Avatar-blank-50x50

Drew Sanocki, Founder at Empire Growth Group, Inc.

I'm realizing Days since Last Session isn't what I thought it was. I have been looking for a recency metric -- i.e., days since the user was most recently on my site, measured in "days ago" as in "this guy was last on my site (or purchased for an ecom site) 3 days ago, and this other guy 8 days ago". Not a latency metric which is what Days Since Last Session appears to be (i.e., days between recent visits).

Any idea how to get the recency metric I am talking about? And create a custom segment around it?

3 months ago

Comment
No-profile-pic
Save or Cancel
Daily_pulse_signup_wide

Enjoying this article?

Get more just like this, delivered to your inbox.

Keep up to date with the latest analysis, inspiration and learning from the Econsultancy blog with our free Daily Pulse newsletter. Each weekday, you ll receive a hand-picked digest of the latest and greatest articles, as well as snippets of new market data, best practice guides and trends research.