I believe that every business can use Google Analytics custom variables. Especially ecommerce businesses. Custom variables inject new data dimensions that are crucial for segmentation. As analysts we need to do segmentation to understand user behavior. And ecommerce sites have certain unique behaviors that are not tracked with a basic Google Analytics implementation.
For those that have not used custom variables before you can get read Mastering Custom Variables for overview.
Now on to the custom variables!
Tracking Coupon Codes and Promotional Codes
I think this is a pretty obvious use of custom variables. If you sell something you probably run various promotions. And you need to track these promotions to see how they perform. Some promotions can be tracked using campaign tracking. I’ve seen lots of people use the utm_content parameter to identify the promotion in a marketing campaign, like an email. But a custom variable works just as well.
When coming up with a strategy think about how you might scale this as time goes on. Do you want all of your promotional codes aggregated together under one variable? You could do something like this:
Or you could get fancy and use different custom variables to bucket groups of promotions, like seasonal promotions. For example, if you lots of promotions during the holiday season you might want to create a custom variable named HolidayPromos and then a unique name for each of the codes, something like this:
The above code would need to appear on your receipt page. And remember, the slot, or index, in the code above may be different for you. It all depends on your use of custom variables.
You might be wondering why I decided to go with a page level custom variable here. Remember, Google Analytics will sessionize a page level custom variable. So even though the custom var will only fire on the receipt page the data will be applied to the entire visit.
Tracking Payment Method
Remember, we study visitor behavior to understand the impact on business. One of these behaviors is how people pay for a purchase. Is there a difference between a visitor who pays with a credit card vs one who pays with PayPal? Does one spend more, on average, than the other? You’ll never know unless you capture payment type and review metrics like average order value and conversion rate.
To capture payment type use a page level custom variable. The resulting GA code will look something like this:
Don’t forget to replace
with the customer’s payment method.
Tracking Shipping Method
Like payment method, it’s interesting to see what shipping method people choose with various products. Why? Perhaps people who buy certain products choose certain types of shipping. If so, maybe you can build a new promotion using this information. Could there be no insights here? ABSOLUTELY! But you’ll never know unless you have some data and do a bit of analysis.
Tracking Repeat Customers
I remember reading Eric Peterson’s book Web Analytics Demystified a looong time ago. Besides being one of the first books on analytics it was exceedingly actionable. One of the ecommerce key performance indicators Eric talked about, and rightfully so, was the repeat-buyers.
The behavior of repeat customers is different than first time customers. This segment of customers usually takes less time to purchase due to a knowledge of your products and services. Normally it costs you less money to get these people to convert. So it’s a good idea to understand what marketing they respond to and how they use your website.
To track repeat customers in Google Analytics you must use a visitor scope custom variable. Remember a visitor scoped custom variable persists on the visitor’s computer as a cookie. The trick is when you set the custom variable.
Most people think you can set the custom variable when the transaction happens, like this:
But in reality this will not work. When you set a visit level custom variable the value gets applied to the CURRENT visit and all future visits. So you need to wait until the SECOND purchase before setting the above custom variable. Then it should work just fine.
[UPDATE: Elizabeth Brings up a good point in the comments. This method will only work if the visitor comes back and makes a second purchase on the site. You can tweak the above logic and set the custom variable on the visitor's return to the website, rather than when they make a second purchase. While this is not perfect it is a workaround.]
I should note that this is an AWESOME custom variable to use in an advanced segment. Actually, they’re all great to use in Advanced segments, but segmenting repeat buyers is especially useful
This is where things get a little more complicated. Tracking things like purchase history requires a bit of configuration on the server side, meaning you or your nerds need to create some code to categorize customers based on the number of purchases they’ve made in the past. Rather than track every single purchase I prefer to bucket the purchases, like this:
- 1 to 3 purchases
- 4 to 6 purchases
- 7 + purchases
Now you’re probably thinking that there is some duplication with the previous custom variable, and you’re right. The repeat customer variable is a bit more generic and gives you a quick view of new and returning customers. The purchase history variable is geared towards deeper analysis of customer behavior.
So there you have it, five custom variables for ecommerce websites. This is by no means an exhaustive list, but I think these can help any commerce based business to better segmentation and analysis.
Are you using custom variables on your ecommerce website? If so I’d love to hear how!