Practical Ecommerce

Using Google Analytics to Track Profitability by Product

Niche ecommerce merchants must focus on cash flow. They do not have large capital reserves to support unprofitable investments. Although growing sales is good for the ego, growing cash flow is what puts food on the table. In this article, I’ll address how to use Google Analytics to track profitability by product category — reporting on sales, cost of goods sold, and advertising expense — to maximize cash flow.

Not all of the data has to come from Google Analytics, by the way. Merchants could use data from other sources, so long as those sources provide:

  • Sales by product category;
  • Cost of goods sold by product category;
  • Advertising cost by product category.

Reporting Sales by Product Category

Google Analytics ecommerce tracking can report sales by product category. To view sales by category, go to Conversions > Ecommerce > Product Performance and select “Product Category.”

To view sales by category, go to “Conversions > Ecommerce > Product Performance.”

To view sales by category, go to Conversions > Ecommerce > Product Performance.

Reporting Cost of Goods Sold by Product Category

Google Analytics has a feature to import product cost data. To set this up, first create a new custom metric at Admin > Property > Custom Definitions > Custom Metrics.

Under “Custom Definitions”, click on “Custom Metrics.”

Under “Custom Definitions,” click on “Custom Metrics.”

Name the metric “Product Cost” and assign the scope to be “Product” level and the formatting type as “Currency (Decimal).” Leave “Minimum Value” and “Maximum Value” blank.

Name the custom metric “Product Cost” and assign the scope to be “Product” level and the formatting type as “Currency (Decimal).”

Name the custom metric “Product Cost” and assign the scope to be “Product” level and the formatting type as “Currency (Decimal).”

For the data import, go to Admin > Property > Data Import.

Select “Data Import” under the Property column.

Select “Data Import” under the Property column.

Then create a new data set for “Product data.”

Create a new data set for "Product data."

Create a new data set for “Product data.”

Name the data set “Product Cost” and select a Google Analytics view to receive the imported data and click “Continue.”

Name the data set "Product Cost."

Name the data set “Product Cost.”

Then select “Product Cost” as the imported data.

Select “Product Cost” as the Imported Data.

Select “Product Cost” as the imported data.

Leave “Overwrite hit data” set to “No” when both imported data and hit data are available. Save and then click on “Get schema.”

Leave “Overwrite hit data” set to “No” when both imported data and hit data are available. Save and then click on “Get schema.”

Leave “Overwrite hit data” set to “No” when both imported data and hit data are available. Save and then click on “Get schema.”

Click on “Download schema template” to get the template to populate product cost data.

Click on “Download schema template” to get the template to populate product cost data.

Click on “Download schema template” to get the template to populate product cost data.

Populate the schema template with all product SKUs and their per-item cost.

Populate the schema template with all product SKUs and their per-item cost.

Populate the schema template with all product SKUs and their per-item cost.

Then save the schema template and go to “Manage uploads” to upload the product cost data.

Go to “Manage uploads” to upload the product cost data.

Go to “Manage uploads” to upload the product cost data.

Note that the product cost import is not retroactive (unless you are using Google Analytics 360, the enterprise version). So product cost will start populating after you import an SKU and its cost.

Create a “Calculated Metric” for cost of goods sold by going to Admin > View > Calculated Metrics.

Create a "Calculated Metric" for cost of goods sold by going to Admin > View > Calculated Metrics.

Create a “Calculated Metric” for cost of goods sold by going to Admin > View > Calculated Metrics.

Name it “COGS” and set the Formatting Type to “Currency (Decimal).” Enter the following formula.

( ( {{Quantity}} ) / ( {{Unique Purchases}} + {{Product Detail Views}} + {{Product Adds To Cart}} ) ) * {{Product Cost}}

Name the calculated metric “COGS” and set the Formatting Type = “Currency (Decimal).”

Name the Calculated Metric “COGS” and set the Formatting Type to “Currency (Decimal).”

Create another Calculated Metric called “Product Profit”  — which is also formatted as “Currency (Decimal)”) — using the following formula.

 {{Product Revenue}} - ( ( ( {{Quantity}} ) / ( {{Unique Purchases}} + {{Product Detail Views}} + {{Product Adds To Cart}} ) ) * {{Product Cost}} )

Create another Calculated Metric called “Product Profit.”

Create another Calculated Metric called “Product Profit.”

You are now ready to report gross profit  — sales less cost of goods sold — by product category. Here is the custom report that will provide this data.

Use this custom report for gross profit by product category. <em>Click image to download.</em>

Use this custom report for gross profit by product category. Click image to download.

If you cannot access or save my report, you can develop your own, at Customization > Custom Reports > New Report. Use the followings settings in the “Report Content” section.

  • Type: Flat Table
  • Dimensions: Product Category (Enhanced Ecommerce)
  • Metrics: Quantity, Product Revenue, COGS, Product Profit

Reporting Advertising Cost by Product Category

Setting up a reporting dashboard to track gross profit after advertising cost enables merchants to identify which categories generate the most cash flow. The optimal way to report advertising cost by product category is to structure advertising campaigns and ad groups to align with product categories. That way Google AdWords, Bing Ads, and other campaigns and their ad groups can be combined with category sales to report gross profit after advertising.

Google AdWords cost data should be available in Google Analytics if you have integrated AdWords with Analytics. You can import into Google Analytics the cost for Bing Ads and other advertising channels. I explained how to set this up at “Using Google Analytics to Optimize Bing Ads, Other Channels.”

Advertising spend reports are at Acquisition > Campaigns > Cost Analysis or you can create a custom report for output you need.

Find advertising spend reports at Acquisition > Campaigns > Cost Analysis.

Find advertising spend reports at Acquisition > Campaigns > Cost Analysis.

Putting It All Together

Having set up the Google Analytics reporting detailed above, we then generate two reports to assemble a “Gross Profit after Advertising” report.

  • Gross Profit by Category
  • Advertising Cost by Category

Export those reports from Google Analytics and combine into a spreadsheet. Name the spreadsheet “Gross Profit after Advertising” and it’s done. You can now track profitability for each of your product categories.

Editor’s Note: This article was updated on June 13, 2017.

Morgan Jones

Morgan Jones

Bio   •   RSS Feed


email-news-env

Sign up for our email newsletter

  1. Kristoffer Nyhlen May 9, 2017 Reply

    Thanks for a really useful article about how to maximise Google Analytics. One question. Google are not taking any VAT into consideration when showing the e-commerce data. Generating these reports you are describing should not have any VAT on the revenue. Is there any way to have Google generate these reports while also removing the VAT?

    Kind regards
    Kristoffer

    • Morgan Jones May 9, 2017 Reply

      Hi Kristoffer,

      Reporting Product Revenue instead of Total Revenue (which would include tax and shipping) would be my suggestion. This assumes you are collecting VAT during checkout and not paying this extra tax yourself with no help from your consumers. If you are absorbing the VAT yourself, then I would estimate the % and reduce your sales by that %.

      Thanks,
      Morgan

  2. Jeremy June 11, 2017 Reply

    Great article and trying to implement now.

    The Custom Report template link is dead.

    “You are now ready to report gross profit — sales less cost of goods sold — by product category. Here is the custom report that will provide this data.” <– This report for GA

    Any chance of getting an update?

    Thanks!

    • Jeremy June 11, 2017 Reply

      Or, it might not be “dead”, it might be that I don’t have the correct information for the report to be pulled. I’m getting this error msg when I try to add the Custom Report:

      “Invalid schema.
      There was an error retrieving the requested dimensions/metrics.”

      Any thoughts?

      • Morgan Jones June 13, 2017 Reply

        Hi Jeremy,

        Thanks for the head’s up about the Custom Report link not working! I just published an update to include the Custom Report details so you can set it up yourself. Here’s what was added to the article today just below the link to the Custom Report:
        ———————————
        If you cannot access or save my report, you can develop your own, at Customization > Custom Reports > New Report. Use the followings settings in the “Report Content” section.

        Type: Flat Table
        Dimensions: Product Category (Enhanced Ecommerce)
        Metrics: Quantity, Product Revenue, COGS, Product Profit

  3. Jeremy June 14, 2017 Reply

    Thanks for the update Morgan. The manual custom report worked?

    Any idea why the COGS is being shown as 2x the actual product cost I entered in column 2 of the data sheet I uploaded?

    • Morgan Jones June 14, 2017 Reply

      Hi Jeremy,

      I think I know why as setting up COGS depends on what Enhanced Ecommerce hits you are sending per SKU. Please contact me offline and I would be happy to help you get this straightened out.

      Thanks,
      Morgan

  4. Peder June 27, 2017 Reply

    How to avoid COGS showing the wrong numbers. all views / click on the product counts as 1 cost.

    Best regard
    Peder

    • Morgan Jones June 27, 2017 Reply

      Hi Peder,

      Thanks for your comments.

      Reporting COGS can be tricky. I suggest you contact me offline to help you get this set up.

      Thanks,
      Morgan

  5. Tom August 15, 2017 Reply

    Can you explain the logic around the COGS formula? It’s not clear to me why I would include the number of products added to a cart/product detail views in that calculation.

    • Morgan Jones August 15, 2017 Reply

      Hi Tom,

      Great question!

      The Enhanced Ecommerce “Quantity” metric is incremented whenever there is an Enhanced Ecommerce event, such as a Detail View, Add To Cart, Transaction , etc and is incremented by the “Quantity” included in the event for a particular SKU. We have to include all Enhanced Ecommerce hits into the denominator of the equation to cancel them out from the numerator (Quantity) so all that is left is the actual Quantity purchased.

      Hope this helps.