Episode #5

How To Use Google Analytics I: Ecommerce & UTM

I begin by explaining Google Analytics channel groupings (direct vs paid vs social etc.) and the importance of connecting Analytics to your revenue data with Analytics ecommerce features. Next I show you how to compare your e-commerce conversion rates and per-session values across your various marketing channels. From there, I introduce UTM tagging, a fundamental building block in all online marketing, and I demonstrate how to test UTM-tagged urls using realtime reporting. Lastly, I explain why it's wiser to keep your Analytics integration outside of inline HTML script tags and, instead, purely inside your JS build environment (e.g. webpack etc.)

September 27, 2020

Show Notes

No notes available for this episode.

Screencast.txt

Transcribed by Rugo Obi

For most websites, including my own, Google Analytics is an absolute game changer.

If you're proficient at analytics, you’ll be able to market far far far more efficiently. And you'll also be able to detect technical bugs, based on statistical anomalies you'll notice within the analytics interface.

Unfortunately the analytics interface is extremely confusing and overwhelming.

So what I'd like to do in the upcoming videos is to demonstrate a bunch of workflows that I use within my business in order to get actionable insights.

The idea is that you'll be able to follow along with some concrete data, and then apply the same workflow to your own website.

--

I'm gonna save the best for first.

This is my favorite report in Google Analytics. We're looking at Acquisition > All traffic > Channels, combined with the E-commerce sub view or whatever you want to call that. (I'm going to make this go away. It's too large.)

So, what we see here are different channels through which you can get traffic.

For example, Organic search. That's what you think it is: people googling random terms and ending up on your website.

Direct traffic, which is when people go into the URL bar and type in https:// www.oxbridgenotes.com or whatever and visit your site.

It also captures some other traffic where Google's kinda unable to discern where it comes from - some email traffic accidentally ends up there and so on. But don't worry about that too much.

This is roughly a proxy for your branding, because if people specifically look for your website, then you've built up a brand and they're coming there not because they stumbled on it on Google, but because they want what you have to offer.

The next is Referral traffic that's when other websites link to you, and people arrive on your website via that link.

This is distinct from Social traffic which you'll see down here.

So Google tries to separate out Referral traffic from the likes of Reddit and Facebook and Twitter and so on, and put that into the social bucket. Whereas Referral that's other websites and blogs and whatnot linking to you.

Then there is Paid Search that basically means Google AdWords. You can also have other sorts of paid advertising in there as well.

Next, there's Display ads, those are those banner ads you see around the web.

And Other, I don't really know what that is, I don't think it's important.

And then Email. I haven't actually set this up correctly but I'll talk about how to do that later. But this is generally people arriving on your website thanks to some links that you put in emails.

So all these channels I just discussed, they are the primary dimension. And then we have these other dimensions along the x axis.

So here we have Users, the number of users that came from that channel. You can see here that the vast majority, 90% came from organic search because that's my preferred strategy.

Then you see all the others here and there's a number of Sessions: a user can have multiple sessions.

Here we get to the business-related dimensions.

This one is Revenue. I've set that up thanks to Google Analytics Ecommerce features. You can see how much money I earned from this channel, a total of 40K, and how much I earn from this channel 3K, and so on and so forth.

Here we have the absolute number of transactions in that time period. 1242 transactions came via organic search, 80 from people typing in my URL directly, 41 from referrals, and so on.

We get the average order value Avg. Order Value, multiply these two and you get revenue.

And then you get a really interesting one, Ecommerce Conversion Rate. What percentage of sessions end up actually buying something?

So the average is in this top row here -the average’s across the whole set of channels- and that's 0.37%, then you can see how it differs depending on which one of these channels we're looking at.

So Organic Searchnis close to the average with 0.33%, but if you scroll down here, Paid Search is 1.55%, that's far far far higher. This traffic converts much better. And then ‘Social` is a whopping 5.48%.

This is a really really high converting traffic, and I should probably be spending a lot more efforts on getting that traffic based on what I'm seeing here.

These are the kind of insights that make Google Analytics so priceless.

Next we get a related and very useful figure - the Per Session Value.

So, on average, each one of my sessions over this period was worth 12 cents.Organic Search was worth 11 cents, Direct 14, Referal 26 cent, Paid Search 57 cent and Social 2 euro.

This figure is extremely useful because it allows you to quantify your marketing results in each dimension, and that in turn can tell you how much effort or money you should spend in each of these.

For example, in Paid Search, if I can get a Paid Search click for 30 cent and I make an average of 57 cent from that, then I’m making a tidy profit on that traffic at least from a purely advertising point of view.

How does Google know what traffic goes in which one of these channel groupings? Well you can customize these channel groupings within the admin area of Analytics, but these are the system defaults. They are only as good as the information you provide Google. It does its best, but often, it cannot infer the information correctly.

That's why I only have one email user — despite me being a heavy user of email marketing campaigns. The issue is that I had not tagged my URLs correctly.

This brings us to one of the fundamental, most critically important activities in all online marketing: UTM tagging.

UTM tagging basically just consists of adding a couple of GET parameters to the end of one of your URLs, and then Google Analytics just automatically parses that information.

I'm going to use the Google Analytics Campaign URL Builder to demonstrate that in a sort of visual manner and this can be a good way to get the hang of it at first.

So let's say I want to market this URL oxbridgenotes.co.uk/law-tutor-jobs, then I have to fill in three sorts of mandatory fields.

One is the Campaign Source. Usually this is the name of the entity doing the marketing.

So, for example, if it's my email newsletter, I would probably just put in newsletter. I would actually put oxbridgenotes-newsletter.

And the Medium, in this case, it's email.

Now that I'm using this, the Email channel grouping you saw on the previous page will actually be populated correctly. And then the Campaign Name this could be cart-abandons or something like that.

If I scroll down here, it shows the URL created, and you see that there's basically just these three parameters added:

utm_source=oxbridgenotes-newsletter&utm_medium=email&utm_campaign=cart-abandons

One thing to note is that these parameters will be viewable elsewhere online. So if you drop a link to your website with these parameters in some sort of public forum, it may look a bit bad or you may even get auto-banned because of it.

Therefore, a lot of people like to convert these into sort of a tiny URL thing. (I need to be logged-in for that. Doesn’t really matter.) Basically it's a Bit.ly or equivalent.

So let's demonstrate those UTM parameters in action.

I'm going to visit the URL I just generated, and we can see I'm on one of my pages "Become A Law Tutor", blah blah blah.

Now, I'm going to pop back over to Google Analytics and open up one of the real-time reports, in this case the Traffic Sources report.

And you can see here that there is something with Medium equals "email", Source equals "oxbridgenotes_newsletter" and one active user - that's me. And this information will then be parsed and available within that channel breakdown I showed you earlier.

So the UTM tagging covers how to steer Google Analytics into classifying these correctly.

And more specifically you're setting the source/medium, which you can also filter by and is often more useful, and then Google Analytics will parse that data and turn it into the channel groupings you see here.

But what about this Revenue figure and the transactions? How do you get that data into Google Analytics?

It turns out to be surprisingly simple.

So the first thing we have to do is to enable that feature.

So here's my kind of admin area in Google Analytics and I'm choosing the Property "OxbridgeNotes" and the Production view.

And within this you see Ecommerce settings, and we go in here and if you have a new account, I believe they start off with the setting off, so you just switch them both on. The Checkout Labelling is not too important. I'm not going to deal with that now.

And once you have that done, then you have to go over to your code and send some transaction-specific data.

I’m over in my code now, I'm in the download_notes page.

This is the page that people arrive on after having made a purchase on my website. And I have this bit of code here, an if statement. if order_just_completed, and this kind of looks at some session data to figure out if the order just happened, or if a user had landed on that page a second time for some reason. This is in order to prevent double reporting. I don't think this is super important anymore - at least with Google Analytics - because they also track transaction ID, but it could be important with other analytics platforms and it doesn't hurt to protect against it. There's nothing worse than having faulty data in Google Analytics.

Anyway, assuming this is genuinely at the end of a new conversion, I tried to generate a div that looks like this.

This is kind of regular div with no content, but a lot of attributes <div data-conversion='purchase' data-currency='eur'... />.

It's actually created here with some Ruby specific stuff, and I set the currency based on the @order. currency, the value of that order to me, and a transaction_id.

So all I do is, I attach the JavaScript data to the DOM, in the form of this div. I do not call any script tags here, like the Google Analytics documentation suggests.

The reason I don't do that is because I want to use ES6, and I want to use cross-browser compatibility and so on in my JavaScript, therefore I want all my JavaScript to happen within the Webpack world. So I save the actual JavaScript for that, and it's over there now.

So here I set a variable called conversion to that particular div, and then later on in the code, if I scroll down here, I grab all the data on that div element. That's what this .dataset does, it kind of gives you -I think- an object with all that data. And then I feed that into a function trackGoogleConversion.

And if the conversion type is purchase, which we just saw it was here - you see conversion: purchase. Then I trackEvent("purchase", {...}), sending these tidbits of information: the transaction_id, the value of that order, and the currency.

Let's take a quick look at how this trackEvent is defined, and you see it here.

This calls the kind of raw Google Analytics stuff, and gtag( “event”, then the event name, I think purchase in this case, and then the extra data.

In fact, if you want to go super raw, this is what Google Analytics would define themselves, what the gtag function does.

See you next week.