measurecamp - improving e commerce tracking with universal analytics

37
Improving e-commerce analytics with Universal Analytics Matt Clarke @techpad techpad.co.uk Sunday, 17 February 13

Upload: matt-clarke

Post on 27-Jan-2015

113 views

Category:

Technology


3 download

DESCRIPTION

My MeasureCamp presentation covering how I've used the beta version of Universal Analytics and Measurement Protocol to extend the e-commerce analytics functionality of GA.

TRANSCRIPT

Page 1: Measurecamp - Improving e commerce tracking with universal analytics

Improving e-commerce analytics with

Universal AnalyticsMatt Clarke @techpad

techpad.co.uk

Sunday, 17 February 13

Page 2: Measurecamp - Improving e commerce tracking with universal analytics

I love Google Analytics, but as an e-commerce director, I encounter questions every day that it can’t answer.

@techpadSunday, 17 February 13

Page 3: Measurecamp - Improving e commerce tracking with universal analytics

What’s the conversion rate for product X?

@techpadSunday, 17 February 13

Page 4: Measurecamp - Improving e commerce tracking with universal analytics

What’s the conversion rate for product X?You can’t easily determine the conversion ratefor products, categories or brands to monitor trends or optimise them. You might be able todo it externally with API hacks, but it’s not easy...

@techpadSunday, 17 February 13

Page 5: Measurecamp - Improving e commerce tracking with universal analytics

How much stock of brand Y did we sell?

@techpadSunday, 17 February 13

Page 6: Measurecamp - Improving e commerce tracking with universal analytics

How much stock of brand Y did we sell?Oddly, brand isn’t a standard dimension. Reportingon brand performance requires manual customreports or dashboards.

@techpadSunday, 17 February 13

Page 7: Measurecamp - Improving e commerce tracking with universal analytics

How profitable is that Adwords campaign?

@techpadSunday, 17 February 13

Page 8: Measurecamp - Improving e commerce tracking with universal analytics

How profitable is that Adwords campaign?Google Analytics doesn’t consider Cost Of Goods Sold (COGS), so to calculate profit, you need to doit all externally. There’s no cost import option forproduct costs yet.

@techpadSunday, 17 February 13

Page 9: Measurecamp - Improving e commerce tracking with universal analytics

What’s the average margin for that category?

@techpadSunday, 17 February 13

Page 10: Measurecamp - Improving e commerce tracking with universal analytics

What’s the average margin for that category?Similarly, because there are no cost data for productcosts, you can’t easily monitor margin trends...

@techpadSunday, 17 February 13

Page 11: Measurecamp - Improving e commerce tracking with universal analytics

When we increase the price of product X, what proportion of customers buy, defect or switch brands?

@techpadSunday, 17 February 13

Page 12: Measurecamp - Improving e commerce tracking with universal analytics

When we increase the price of product X, what proportion of customers buy, defect or switch brands?Price Elasticity of Demand analysis would be nice, as would metrics on latency to indicate which of the customers we acquired are still customers.

@techpadSunday, 17 February 13

Page 13: Measurecamp - Improving e commerce tracking with universal analytics

Google could fix some of this for us now...• If you could import product cost data, you

could see product profit and margin, and the actual ROI/profitability of ads.

• If you could connect Google Merchant Center data to GA you could get product conversion rate, brand performance data and new variables to use as custom segments. (You can do it with the API.)

@techpadSunday, 17 February 13

Page 14: Measurecamp - Improving e commerce tracking with universal analytics

That’s unlikely. But Universal Analytics might help...

• You can create custom dimensions for product, brand, manufacturer and supplier to improve reports and aid analysis.

• You can create custom metrics for product cost, profit, margin and shipping costs.

• It’s in beta and not everything works properly (or at all) yet. It has limitations, but it’s still a big step forward.

@techpadSunday, 17 February 13

Page 15: Measurecamp - Improving e commerce tracking with universal analytics

Here’s how I’ve used it

@techpadSunday, 17 February 13

Page 16: Measurecamp - Improving e commerce tracking with universal analytics

Measurement Protocol and Universal Analytics

• I opted to use a combination of the client-side Universal Analytics (analytics.js) and the server-side Measurement Protocol.

• Using Measurement Protocol allows me to bypass the event limits of Universal Analytics and to send data (such as profit and product cost) that I don’t want to appear in the client-side JavaScript code.

@techpadSunday, 17 February 13

Page 17: Measurecamp - Improving e commerce tracking with universal analytics

Server-side data layer

• To ease data access, I created a server-side data layer containing data objects for page, product, customer and transaction.

• I push data to the client-side code from the (private) server-side data layer.

• If I later decide to move to Google Tag Manager, or even switch analytics vendors, it’s a relatively easy task.

@techpadSunday, 17 February 13

Page 18: Measurecamp - Improving e commerce tracking with universal analytics

How it looks...

Page object Customer object Order object Product object

Web analyticsextensionDatabase

Data layer MeasurementProtocol and UA

@techpadSunday, 17 February 13

Page 19: Measurecamp - Improving e commerce tracking with universal analytics

How it works

Product page

Data layer Web analyticsextension

Page type?

UniversalAnalytics

MeasurementProtocol

Other page Order page E-commerce tracking, plus product, supplier, manufacturer custom dimensions. Plus...

Sensitive stuff I don’t want to be visible in theclient-side source code, ie. profit and margin.

The usual, plus product,supplier, manufacturercustom dimensions to connect at order page...

@techpadSunday, 17 February 13

Page 20: Measurecamp - Improving e commerce tracking with universal analytics

Universal Analytics

@techpadSunday, 17 February 13

Page 21: Measurecamp - Improving e commerce tracking with universal analytics

The basics of UA

• Uses analytics.js instead of ga.js and replaces all the old GA cookies with _ga.

• Has a totally new syntax, but all the good stuff remains - including events.

• Custom dimensions and metrics replace the old custom variables.

• Will support user ID (but doesn’t yet).

@techpadSunday, 17 February 13

Page 22: Measurecamp - Improving e commerce tracking with universal analytics

How I’ve used it

• On the product page, I’m firing custom dimensions for: product, brand, manufacturer, supplier, author and product cohort.

• I’m hoping to connect these with data fired on the payment complete page (attached to transaction/item) to allow me to get data on stuff bog standard GA can’t measure.

@techpadSunday, 17 February 13

Page 23: Measurecamp - Improving e commerce tracking with universal analytics

An overview of custom dimensions and metrics

• First, define your custom dimension/metric in the Google Analytics UI.

• Send your CD/CM with another data type, such as a pageview or an event.

• ga(‘send’,‘pageview’,{dimension1:‘Apple iPad 3’});

• You can combine several together.

@techpadSunday, 17 February 13

Page 24: Measurecamp - Improving e commerce tracking with universal analytics

Measurement Protocol

@techpadSunday, 17 February 13

Page 25: Measurecamp - Improving e commerce tracking with universal analytics

The basics of MP

• A server-side way of sending GA data (like PHP-GA), based on a simple URL system. You send a payload to an HTTP endpoint.

• Sending data with an HTTP POST returns a 200 OK. (Sadly, even if it’s malformed...)

• There’s currently no client library, so you’ll need to code your own. However, this is quite straightforward with PHP and Curl.

@techpadSunday, 17 February 13

Page 26: Measurecamp - Improving e commerce tracking with universal analytics

How I’m using it

• Used on payment page to send data I want to hide from anyone viewing the source.

• I want to supplement the e-commerce tracking with extra custom dimensions and metrics, such as product, brand, supplier, manufacturer, profit and margin. *

• I’m joining these to UA dimensions fired on the product pages attached to pageviews.

@techpadSunday, 17 February 13

Page 27: Measurecamp - Improving e commerce tracking with universal analytics

What do I send?

• Latency - days since last purchase (CM)

• Customer cohort (event)

• Days as customer (event)

• Lifetime spend (event)

• Carrier (CD)

• Newsletter preferences (CD)

@techpadSunday, 17 February 13

Page 28: Measurecamp - Improving e commerce tracking with universal analytics

What do I send?

• Product (CD)

• Brand (CD)

• Manufacturer (CD)

• Supplier (CD)

• Product author (CD)

• Product cohort (CD)

@techpadSunday, 17 February 13

Page 29: Measurecamp - Improving e commerce tracking with universal analytics

What do I send?

• Product cost (CM)

• Product margin (CM)

• Product profit (CM)

• Shipping cost (CM)

• However, the CMs and CDs attached to the item and transaction don’t work yet.

@techpadSunday, 17 February 13

Page 30: Measurecamp - Improving e commerce tracking with universal analytics

Using Measurement Protocol alongside Universal Analytics

@techpad@techpadSunday, 17 February 13

Page 31: Measurecamp - Improving e commerce tracking with universal analytics

Using Measurement Protocol with Universal Analytics

• Measurement Protocol and UA use a visitor ID called the client ID (or cid).

• This isn’t to be confused with the user ID. (That doesn’t exist yet.)

• If you want to use Measurement Protocol and UA together, you need to use the same client ID. Otherwise GA won’t connect the data to a given visitor.

@techpadSunday, 17 February 13

Page 32: Measurecamp - Improving e commerce tracking with universal analytics

32-bit IDs vs UUID v4

• Universal Analytics (ga.js) cookies use the old-style 32-bit UUIDs for compatibility with the current version of GA.

• The docs (and GA team) recommend using UUID v4 for client ID, but (undocumented) it can also support 32-bit IDs.

• If you want to use both together, you need to use the _ga 32-bit ID, not UUID v4.

@techpadSunday, 17 February 13

Page 33: Measurecamp - Improving e commerce tracking with universal analytics

Obtaining the 32-bit ID

• Parse the new _ga cookie to obtain a given visitor’s 32-bit ID to send with MP data.

• Example: 1.2.123456789.9876543219876

• Extract the last two items from the cookie and use that as your 32-bit ID.

• I’ve written some cookie parsing code. Get a copy from here: http://goo.gl/HgCew

@techpadSunday, 17 February 13

Page 34: Measurecamp - Improving e commerce tracking with universal analytics

To round up...

@techpadSunday, 17 February 13

Page 35: Measurecamp - Improving e commerce tracking with universal analytics

Measurement Protocol and Universal Analytics are amazing

• They open up new possibilities for tracking.

• They should help improve analysis.

• They’re better integrated than CVs.

• You get 20 CDs and 20 CMs.

• The new user ID (when supported) should make even more cool stuff viable.

@techpadSunday, 17 February 13

Page 36: Measurecamp - Improving e commerce tracking with universal analytics

But there are a few issues...

• You can’t send custom dimensions and metrics with either a transaction or a transaction item yet. However, the GA team is planning to add support, which is great.

• At the moment, custom metrics can’t include a decimal point. Why? (Consider rounding and multiplying, extracting in API, then dividing to get the original value.)

@techpadSunday, 17 February 13

Page 37: Measurecamp - Improving e commerce tracking with universal analytics

Tips

• Using a data layer means you can use data in Measurement Protocol and Universal Analytics easily and keeps things tidier.

• Use Measurement Protocol to send stuff you don’t want visible in the JS code.

• Parse the 32-bit ID from the _ga cookie and use it as the Measurement Protocol client ID, if using both together.

@techpadSunday, 17 February 13