Hero image

Tracking E-Commerce Payment Options in Google Analytics

Written by Jamie
Get in touch
intro.

Picture this – you’ve got an e-commerce website with multiple payment options at checkout. One might be PayPal, one might be Stripe, then you might have a finance option, an integrated credit card processor, and so on. There are a lot of choices here and quite often you will want to offer more than one. This is normal – customers like options and may have a preferred method of paying for any number of reasons. The last thing you want is for a customer to bounce at checkout because you don’t offer the payment option they’re most comfortable with.

This post is going to explore what these different checkout options mean to you as an e-commerce store owner.

Different Processing Fees From Different Payment Options

This is the first thing to consider – your different payment options will most likely incur different fees from their providers. How will this effect your bottom line? Do you want to account for payment processing fees in your revenue calculations? (If you’re operating at any kind of scale, this will be a resounding “yes”!)

It gets trickier – what if you offer a finance payment option? No money may change hands at the time of the transaction. You’re selling a product and it’s not directly affecting your revenue. Most likely the finance company will collect money on your behalf and over a period of time, charge their fee, and pass the rest to you. What about if the person who bought the product and applied for finance never finished the application, or got rejected? We refer to revenue generated by finance applications as “soft revenue” to cater for exactly this case.

Splitting Out Payment Options In Google Analytics

Now we’ve outlined the problems, let’s come up with the solution.

If you’re running an e-commerce website you most likely can see your revenue figures in Google Analytics. However if you want to split these numbers by payment option you most likely won’t be able to find the required control. This is part of Google Analytics’ Enhanced Ecommerce suite of functionality, and it is rarely integrated fully into e-commerce websites. The usual reason for this is that it’s a lot of development work, and it is, but you can cherry-pick the features you want to integrate. So if you know you want exactly this feature reporting, that can be a lot easier for a developer to swallow.

The first thing you need to do is manually enable Enhanced Ecommerce in your Google Analytics view. Go to your view admin, then to Ecommerce Settings and flick the switch.

Enhanced Ecommerce Google Analytics option

Enhanced Ecommerce Google Analytics option

Now, providing you’re using the analytics.js implementation of Google Analytics, you can add this line to enable Enhanced Ecommerce after your existing tracking code. (If you’re using the newer, recommended gtag.js implementation you do not need to bring in the plugin at all. Also note that all code examples in this article are for analytics.js, they will need converting for gtag.js.)

ga('require', 'ec');

All you have to do now is tell Google Analytics which payment option was provided at checkout. There are a few different ways to do this, but our preferred method is to send the data dynamically when the user selects the option on the checkout page. Do this by adding some code triggered by a click or change event on the payment method UI element.

ga('ec:setAction', 'checkout', {'step': 1, 'option': 'MY_PAYMENT_OPTION'});
ga('send', 'event', 'checkout', 'option', {});

This code is setting the checkout payment option parameter, then sending the data along with a standard Google Analytics event. Be sure to add your own JavaScript to change MY_PAYMENT_OPTION to whichever option was selected by the user. A couple of things to bear in mind here; the step counter integer is largely irrelevant in this example, but is required. Also if you’re worried about sending this data multiple times per user (eg. if they change their mind on the payment method), don’t be – the last value sent will be stored against the transaction.

Once this is implemented and the data is being gathered you can view it in most Google Analytics transaction reports under Dimensions > Ecommerce > Checkout Options.

Google Analytics Checkout Options reporting

Google Analytics Checkout Options reporting

One Last Problem – Google AdWords Reporting

All of the above is brilliant until you want to split these shiny new Enhanced Ecommerce data points in your linked Google AdWords interface. It’s quite easy to imagine you want to split your “soft revenue” figure provided by your finance applications so that you’re not optimising your ad account based on potentially duff orders.

This seems totally possible, considering you can link AdWords at the View level of Google Analytics, and you can apply any Filter you like at that same View level. However, for reasons unbeknown to us, you cannot implement a Filter on a View using Enhanced Ecommerce data points. To get around this you’ll need to implement a Custom Dimension and pass that at the same time as the checkout option. Then implement a Filter using that.

To use Custom Dimensions you first need to set up the dimension in your Google Analytics Property. Then pass through the data alongside the ec:setAction call we made previously.

ga('set', 'dimension1', 'MY_PAYMENT_OPTION');

This data will now be available when you set up a Filter. Again make sure to send through your users’ actual payment choice in place of MY_PAYMENT_OPTION.

That’s all there is to it – let us know if you have trouble integrating this solution into your website. Good luck!

more like this.