how much it costs market online
As business owners, we are always on a quest to ensure we spend our money wisely, so that we can get a solid return on investment. Don’t you agree?

I’m going to share with you how you can calculate what it REALLY costs you to sell your online products. In other words, how much your online sales are costing you in terms of marketing dollars. This calculation is called the Cost Per Acquisition (CPA) for your online sales. Note that the CPA will be different for each marketing campaign you use to sell your products.

The benefit to calculating your CPA is that then you will be able to identify which marketing sources are giving you the most return on your marketing dollars spent in getting online sales.

If you continue to invest in the marketing campaigns that are working the best and then reduce your spend on marketing campaigns that are not working so well, then your overall marketing mix should lead to a growth in your online sales.

There are nine steps involved for calculating your CPA for your online sales. These steps are:

  1. Isolating the relevant sales in Google Analytics
  2. Turn a sale into a Goal
  3. Ensuring that the sales are linked to the original marketing source in Google Analytics
  4. Choosing an attribution model
  5. Choosing a relevant timeframe in which to monitor all the different ways a visitor might come to your website before making the sale
  6. Setting up your marketing campaigns in Google Analytics
  7. Finding out how much you spent on your marketing, money and time
  8. Putting it all together to calculate your CPA
  9. Testing and making adjustments as necessary

If you’re ready to learn how to find out how much it costs you to market your products online, then let’s go!

STEP 1: Isolate the relevant sales in Google Analytics

Before diving in, you first need to consider whether you want to treat all your online sales equally, or whether you want to calculate CPA for only a certain product line or products with a certain price or profit margin. For example, if you sell some products with a high profit margin and some products with a low profit margin, you might want to only calculate the CPA for the high profit margin items, rather than considering all sales equally.
how to calculate your marketing cost per sale Google Analytics

The method for calculating CPA in this article assumes you are counting all sales equally, but you can alternatively isolate your sales to the ones you are interested in and then follow the rest of the process as described.

Alternatively, if you want really high accuracy you could consider all sales but then apply a weighting based on the profit margin of each product line. This strategy is more complicated and is not covered in this article.

If you choose to isolate the sales to only those within a specific product line, price, or some other characteristic of the product, then you will need to capture the characteristics of the sale using Google Analytics ecommerce framework – in addition to recording the completion of the sale.

To identify the completion of a sale, ask yourself the following questions:

  • Does your store display a thankyou page?
  • Do you need to capture a mouse click?
  • If you want to capture a sale with specific characteristics, do you have those characteristics set up as part of Google Analytics ecommerce tracking?
  • Does your sale occur via telephone call or an offline means? If so is there any way that you can track phone calls or a behaviour on your website that indicates the person is a good lead?

You will need to set up Google Analytics and/or Google Tag Manager in order to capture the sales according to your answers to the questions above.

STEP 2: Turn a sale into a Goal in Google Analytics

Once you have set up the ability to isolate a sale, the next thing you need to do is turn that sale into a Goal in Google Analytics. You will want it to be a Goal and not an ecommerce transaction in this case because it is only possible to record a Goal once during a session, whereas an ecommerce transaction can be recorded multiple times. Multiple sales in the one session would really complicate the attribution if attributed separately, so that is why a Goal needs to be used.

STEP 3: Ensure that the sales are linked to the original marketing source in Google Analytics

If your sale is finalised on another website other than your own, you need a way to record it as a completed sale such that the sale is linked to the original marketing source. This may require you to set up cross-domain linking, or even to import sales data into Google Analytics depending upon how the sale is completed.

Some external payment gateways, such as Paypal, enable you to forward visitors who complete their sales to a thankyou page on your own website, so you can capture them when they land on the thankyou page. If this is the case you would need to exclude paypal from your referral list so that landing on the thankyou page is still considered as being within the same session (otherwise it will be a new session with the marketing source listed as

On the other hand, if the sale is entirely contained within your own website, such as a stripe payment on woocommerce then you will be able to get the original marketing source because the visitor has not left your site.

STEP 4: Choosing an attribution model

In some cases your sale will be a simple attribution – a visitor who has never been to your website before saw a link to your website, clicked on it, bought something and then left. In this case you can attribute your sale to the source of the link that was clicked.

In other cases the path to a sale is more complex because a visitor may have browsed your website several times before deciding to make a purchase. As they returned they may have used a different means to find you each time.

For example, the visitor may have seen your display ad on a website or on Facebook, seen a youtube video, seen you on a social channel, subscribed to your email newsletter and/or searched for you on Google, and they may have clicked through to your website using any or all of these marketing campaigns!

In order to calculate your CPA, you need to be able to pick which of these marketing channels attributed to the sale, and this is where an attribution model comes in. You need to pick a model that is going to best reflect your marketing. Keep in mind that this is not a perfect science and no one model is going to fit perfectly and so you are essentially trying to pick the least wrong model.

While a whole book can (and has) been written about attribution models, this article discusses three attribution models that you could pick from when calculating CPA. Go ahead and pick a different one if you like, but these three are the most common.

Last Click

This is Google Analytics’ default attribution model and it attributes the sale to the last time that someone visited your website, irrespective of how many times they went to your website in the past. This model is useful if your visitors do not tend to browse and return to your website before buying from you, or if applying another attribution model is just too complicated in your scenario.

Google Analytics’ free attribution modelling tool can’t be used where you need to apply segments, filters etc to identify the sales you are interested in, and so if your situation is more complex you might end up with Last Click attribution model as it is assumed by default in Google Analytics.

First Click

This attribution model attributes the sale to the first time that someone visited your website irrespective of how many times they visited your website after that, and irrespective of how they visited your website when they made the sale. This only works if the first visit was made within the lookback window selected. First click is good if you want to know which marketing channel made the very first brand impression. But then if you’re going to use this attribution model you will want to carefully consider the timeframe, otherwise if you cut the timeframe too short it is next to useless.


This is probably the least wrong model in most cases, and if your technical setup is not too complex this is the attribution model that is highly recommended for calculating CPA. It gives attribution to each marketing source that led to the visitor reaching your website prior to the sale (within the lookback window) and gives an average weighting to each visit.

STEP 5: Choosing a relevant timeframe in which to monitor all the different ways a visitor might come to your website before making the sale

The lookback window sets the period of time before the sale that you are considering, when identifying which marketing campaigns led to the sale of a product.

Let’s say a visitor visited five times within the 30 days prior to purchasing a product from your store, but then returned after 10 days of not visiting. If the lookback window was set to 30 days you would capture the five visits plus the sale, six visits total. If the lookback window was set to seven days you would capture only the one visit that turned into a sale. In this example it would have been more accurate to set the lookback window at 30 days and capture all six visits to your website.

In general a 30-day lookback window is best to choose, unless you have a much longer marketing timeframe.

If you are not sure and would like to find a report that helps you make this decision, then log into your Google Analytics and look at the Frequency and Recency report (located in Audience → Behaviour → Frequency and Recency). This report has two tabs, Count of Sessions and Days Since Last Session.

Choose a long timeframe such as a year from the date picker. You should be safe to pick a 30-day lookback window if the majority of your visitors have a Days Since Last Session of 7 days or less and a Count of Sessions of 4 or less.

STEP 6: Setting up your marketing campaigns in Google Analytics by creating custom channels

Google Analytics uses the term ‘channels’ to describe the broad categories of your marketing efforts. Google Analytics enables you to use the channels that come out of the box (these are very broad channels such as Paid Search, Organic Search, Social for example), or you can create your own custom channels that you can use to track the results of specific marketing campaigns.

If you want to really accurately track how a marketing campaign is impacting your sales results you will want to create a custom channel for that campaign. Ideally, each of your major campaigns should have its own channel.

If you have more than one campaign within the same broad category (e.g. several different Display Network, Adwords or Social Media Display advertisments from the same source) then try to split those campaigns up as much as possible so that you can determine the effectiveness of each one. One way you might do that is by adding Google Analytics UTM codes into your campaigns, although if you are primarily using Adwords you may find the autotagging feature is enough to enable you to differentiate between campaigns.

To create your own channels, go to your Google Analytics Admin page and go to Channel Settings for your reporting view. Create a new custom channel grouping and add one channel for each marketing campaign.

STEP 7: Find out how much you spent on marketing, both in money and time

Find out how much you spent on ads and professional services related to marketing and do your best to split the costs into the channels you have determined. If you have more than one campaign within the same type of marketing try to split the cost as best as possible. Adwords and Facebook etc should be able to give you a breakdown on a per campaign basis, and you may be able to divvy up any professional services charges over the total number of campaigns they manage.

Now that you’ve added up all the monetary costs, don’t forget your own time and the time of members of your team. These are real costs too!

External professional services will already have an associated monetary cost, but what about internal marketing and administrative staff and/or the business owners’ time? Some online marketing campaigns cost more in time than others – Instagram social media marketing, for example, requires time spent to create graphics and then adding them to Instagram each time. Whereas Google Adwords advertising may not have required any time to maintain, if you were happy with an ad you already had running.

Estimate how much time you spent on each channel and then convert that into a monetary cost by multiplying by your hourly rate. Or if you’re the business owner, the hourly rate of a person who could do the work if you were to delegate it.

STEP 8: Putting it all together to calculate your CPA

Finally it’s time to put all the information you have from Steps 1 to 7 together and calculate your CPA using a spreadsheet.
In the first column list out each of your campaigns.
In your second column list out how many sales Google Analytics says you have made from each of these campaigns using your chosen Attribution model and the Goal you have set.

In the third column write the total cost for that campaign, including monetary cost and time cost converted to monetary cost
In the fourth column, divide the total cost [column 3] by the total number of sales for each campaign [column 2].
If a channel resulted in no sales then the cost per acquisition is infinity

You can now rank your campaigns from highest to lowest price! Did you get any surprises?

A note on display ads and SEO

Display ads might not lead to any sales directly, or may lead to a disproportionately low number of sales. However, they may indirectly assist with sales by creating brand impressions. Visitors may then choose to use organic search to find your website or type your URL directly rather than clicking your display ad. If your display ad has a very high Cost Per Acquisition, you could try pulling the ad for a period of time and then checking whether Direct and Organic Search traffic is still the same or has reduced since ending the display ad (don’t test this at the same time as boosting SEO).

Organic Search may lead to a disproportionately large number of sales. Some searches will be for the company name if the customer already knows your brand, whereas some of these searches will be for your product. If most of your organic search sales are searches for your brand rather than your product, then other methods of marketing your business (either online or offline) may having an indirect impact on this channel.

STEP 9: Testing and making adjustments as necessary

Try turning off your most expensive channel for your next reporting period and then doing this exercise again after some time has elapsed. If your cost per acquisition in any other channel goes up after removing the expensive channel, then the two channels may indirectly affect each other due to brand awareness (an example of this may be Display with Organic Search).
If it looks like two channels affect each other, you could try recalculating your original CPA based on these two channels merged and then compare to see whether removing the channel increased or decreased the combined CPA in the next reporting cycle.

If other CPAs stay the same after removing the most expensive channel then you can reinvest the money that was being spent in the expensive channel into growing the reach of the least expensive channel

Digital marketing is constantly evolving. There are infinite ways to market your business online, and the popularity of different platforms and how they are used by consumers changes all the time. Consider adding some completely experimental marketing campaigns and measure their CPA alongside your more traditional ones. With a bit of experimentation you may discover some great opportunities!

Try calculating CPA for leads rather than sales and see if it changes the way you rank your marketing campaigns. How about these ideas:
Signing up for an email list or coupon code
Incoming telephone calls
Addition to a retargeting list (e.g. abandoned sales)

If you would like further assistance on calculating the Cost Per Acquisition for your ecommerce marketing campaigns then please send an email to Petra Manos at

how to calculate your marketing cost per sale Google Analytics

Share this article!

Nick Hughes

We now have greater insights into how many people visit our site and when, where they come from and the detail of our traffic sources. Glad I spent the time with Petra to cut straight to the insights in our data. Time well spent!

Nick Hughes Successfully Navigating Redundancy Strategy Session May 25, 2017

Nicholls Web Consulting

Utilising Web Data Analytics findings, we have made significant discoveries in user behaviours, and made recommendations based on the available data ensuring that our clients have a well-informed view on their customer’s actions within the web environment. We have found insights from Web Data Analytics have influenced our recommendations in terms of channel spending, and also ways to increase customer conversion based on optimization efforts. I have found Petra easy to deal with and, importantly to us, this works in with our objectives to ensure our clients success.

Eben Nicholls Director - Nicholls Web Consulting Strategic Analysis Report, Booking Gateway Attribution Report June 21, 2017

Erica Stacey Scout Digital

I recently worked with Petra to improve my understanding of Google Tag Manager.

Petra not only provided a solid overview of GTM set up and event tracking, she also provided many tips on best practice, and answered the questions that I didn't even know to ask!

Petra is patient, fun to work with, and her analytical programming mind is hell bent on finding the BEST solution to any data, analytics or tracking problem.

Erica Stacey Scout Digital Marketing Strategy Session June 21, 2017

keneena fanning

This dashboard is sooo much easier to read than the Google Analytics one. I love that you explain what each table means underneath - super helpful. I definitely love visual rather than written info so the graphs are great - and make it much easier to see trends etc. Especially helpful to see where traffic is coming from and how it's converting so I can see where to focus my efforts.

Keneena Fanning Kablooie Store Basic Dashboard May 25, 2017

default gravatar

Petra helped me set up many aspects of Google Analytics, and I now feel confident in finding the information I need. It's definitely increased my understanding of my website audience and the data that comes out of it massively!

Hannah Noble Nipenda Blog May 25, 2017


Subscribe for educational articles written by Petra Manos, the founder of Web Data Analytics

track more