One of the most overlooked yet essential metrics in ecommerce is the Cost of Goods Sold (COGS). Without tracking it properly, it’s nearly impossible to evaluate how much you’re really earning from each product, campaign, or order.
Many Shopify merchants struggle with inaccurate pricing, unreliable ad performance data, and poor inventory decisions, all of which trace back to missing or inconsistent COGS tracking.
Here are five key takeaways from this guide:
✅ COGS shows the true cost of each product sold, including materials, labor, packaging, and production costs.
✅ Gross profit = Revenue − COGS, which is a much more useful metric than ROAS alone.
✅ Google Ads can report gross profit if you include the [cost_of_goods_sold] attribute in your Merchant Center feed.
✅ Many merchants rely on rough estimates or outdated manual inputs, which results in misleading analytics.
✅ COGS tracking doesn’t require perfection, but consistent and structured input helps unlock real profitability insights.
This article will walk through what COGS means in ecommerce, how it’s calculated, how it connects to your Shopify store and ads, and what you can do to improve the accuracy of your tracking and reporting.
What Is COGS in Ecommerce and Why Should Shopify Merchants Care?
COGS, or Cost of Goods Sold, refers to the direct costs associated with producing or purchasing the products you sell. These are not your general business expenses like marketing or rent, but rather the specific costs that go into getting a product ready for sale.
Here’s what typically falls under COGS:
Raw materials used in manufacturing
Packaging supplies
Freight and shipping into your warehouse
Product assembly or production labor
Items purchased for resale
In contrast, things like software subscriptions, customer service, or advertising budgets are considered operating expenses and do not belong in COGS.
So why does COGS matter so much?
It determines your gross profit, which is a clearer reflection of product-level profitability than revenue or ROAS.
It impacts your pricing decisions. If you underestimate your product cost, you may price below what’s sustainable.
It’s essential for financial reporting and taxes. Your taxable income depends on correctly calculated expenses.
It affects inventory management. Accurate COGS helps you identify which products are worth restocking or promoting.
For Shopify merchants who rely heavily on ads to drive growth, tracking COGS is especially important. It allows you to assess not just how much you sell, but how much you keep from each sale.
Shopify COGS Formula and How to Calculate It
The standard formula for calculating COGS is:
COGS = Beginning Inventory + Purchases During the Period − Ending Inventory
Each part of this formula refers to inventory value, not sales revenue:
Beginning Inventory: The total value of unsold stock at the start of the reporting period.
Purchases During the Period: The cost of additional inventory acquired during that time, including materials, packaging, and any related freight charges.
Ending Inventory: The value of remaining inventory at the end of the period.
This calculation gives you the total cost of the products that were sold during the selected time frame.
Example
Let’s say you started January with $10,000 in inventory. You purchased another $5,000 worth of stock in January. At the end of the month, your remaining inventory is valued at $4,000.
Your January COGS would be:
$10,000 + $5,000 − $4,000 = $11,000
That means you sold $11,000 worth of inventory during the month, regardless of the revenue you generated.
What Shouldn’t be Included in COGS?
Marketing costs (ads, email software)
Transaction fees
Website hosting
Salaries for administrative or customer service staff
Why Merchants Often Get It Wrong
Even though the formula is straightforward, many Shopify merchants struggle with accuracy because:
Inventory values are not updated frequently
Discounts, bulk pricing, or shipping fees are left out
COGS per item is static, even when supplier costs fluctuate
They rely on spreadsheets, which aren’t ideal for high-volume stores
This disconnect leads to unreliable profit metrics, especially when evaluating the effectiveness of ads or sales strategies.
How to Track COGS in Shopify (Manual and Automated Options)
Shopify doesn’t automatically calculate or report COGS unless you provide the data yourself. The quality of your profit analytics depends entirely on how this information is entered and updated.
There are two common methods for tracking COGS: manual entry and automated syncing through connected systems.
Manual Tracking in Shopify
Shopify offers a built-in Cost per Item field for each product and variant. You can enter your cost here, and it will be used in Shopify’s profitability reports if enabled.
Steps:
In your Shopify admin, go to Products.
Select a product and scroll down to the Pricing section.
Enter your cost in the Cost per item field.
This method works for small catalogs with stable pricing. However, it becomes difficult to maintain accuracy when:
Supplier prices change frequently
Shipping or handling costs vary by region
Discounts or multi-supplier sourcing are involved
Because the field accepts only one static value per variant, it doesn’t account for real-world fluctuations unless you update it regularly.
Automated Tracking (via Inventory or Finance Tools)
For stores with larger catalogs or international fulfillment, COGS tracking is often handled by inventory management tools, ERP systems, or accounting platforms that integrate with Shopify.
These tools can:
Pull cost data from suppliers or purchase orders
Assign different costs by location, supplier, or variant
Adjust COGS dynamically as inventory changes
Automated tracking also enables per-order cost accuracy, which is useful when combined with analytics tools or when sending COGS to ad platforms.
Recommendation for Shopify Stores
If you’re managing fewer products or costs rarely change, start with manual inputs. For growing stores or multi-channel operations, syncing cost data through integrated systems helps maintain reliability without constant oversight.
Why Google Ads Profitability Depends on Accurate COGS
In Google Ads, most Shopify merchants rely on ROAS (Return on Ad Spend) to evaluate performance. While this shows how much revenue was generated per dollar spent on ads, it leaves out a critical factor: how much the products cost to sell.
Without accurate COGS, ROAS can be misleading. A campaign might show strong returns, but after accounting for product costs, it may actually be unprofitable.
What COGS Adds to the Picture
When you include COGS in your reporting, you can calculate:
Gross profit per product: How much is left after subtracting the cost of the item
Gross profit margin: Profit percentage across campaigns or product groups
Profit-based performance segments: Identify which products bring the highest return after costs
These metrics allow smarter bidding and budget allocation. For example:
You can reduce spend on low-margin items, even if they sell well
You can increase exposure for high-margin products, even if they have a lower ROAS
How Google Uses the COGS Attribute in Merchant Center
The [cost_of_goods_sold] attribute in your Merchant Center feed is what enables Google to show profit metrics alongside ad performance data. While it’s not a required field, it becomes essential if you want visibility into how much profit your ads are generating, not just revenue.
When this attribute is included:
Google calculates gross profit by subtracting the submitted COGS from the conversion value.
Profit-based metrics (like gross profit and gross profit margin) appear in your Google Ads reports.
You can access features like automated discounts, which factor in your profit thresholds.
Requirements for Submitting COGS to Google
To ensure the COGS attribute works correctly:
Use ISO 4217 currency codes (e.g., USD, EUR).
Use a period for decimal points (e.g., 14.99 USD).
Keep the currency consistent with your product pricing.
Provide one value per item, average COGS is acceptable if it varies.
This information is used only for reporting. It doesn’t affect bidding directly but allows you to interpret your results through the lens of profitability instead of just sales volume.
By enabling this attribute, you’re not changing how your ads run, you’re changing how you evaluate their success.
Using Conversions with Cart Data (CwCD) for Better Profit Tracking
Conversions with Cart Data (CwCD) is a feature in Google Ads that captures not just the total order value but also which specific products were purchased during a conversion. This matters because the item clicked in an ad isn’t always the one the customer ends up buying.
By enabling CwCD, you gain visibility into:
The exact items purchased per conversion
Product-level metrics such as quantity sold and gross profit
Which ads or products act as entry points vs actual converters
Why It Matters for COGS
When the [cost_of_goods_sold] attribute is paired with cart data, you get accurate gross profit reporting per item — not just averages across the order.
This enables:
More precise campaign evaluations, especially for multi-product carts
Better understanding of upsell and cross-sell patterns
Data-driven product prioritization in Shopping or Performance Max campaigns

Missing Conversions in GA4 or Meta Ads?
Standart browsing tracking misses conversions - Analyzify adds Server-side tracking for accurate GA4 & Meta reports.How to Use It
To use CwCD with COGS:
Set up purchase tracking through Google Tag Manager or the global site tag.
Ensure item-level data is sent with each conversion event.
Include the COGS attribute in your product feed.
⚠️ Important note: For COGS data to appear correctly in Google Ads reports, the product ID sent with the conversion event must match the ID in your product feed. If there’s a mismatch or inconsistent formatting (e.g. missing variant ID or different structure), COGS won’t be applied to the product in reporting. Make sure your item_id values are clean and consistent across your store, product feed, and tracking setup.
When configured correctly, your reports will show not just revenue per ad but also how much profit each product contributed to the result.
How Analyzify Helps: Tracking Revenue Is Not Enough Without COGS
Analyzify doesn’t manage or calculate COGS - that part is handled through your product feed, inventory tools, or Shopify’s built-in fields. But once accurate cost values are in place, Analyzify plays a key role in ensuring that your purchase tracking includes the necessary item-level data for profit-based reporting in Google Ads.
What Analyzify Enables
Analyzify’s tracking setup ensures that your purchase events include detailed item-level data, such as product IDs, variant details, and revenue values, which are required for Google Ads profit reporting features.
This data is passed through client-side tracking methods, including support for Google’s Enhanced Conversions, which enrich attribution using first-party customer data like hashed email addresses. These enhancements can improve match quality and reporting in Google Ads - but they still rely on browser-based events.
⚠️ Important note: However, even when purchase events are tracked correctly, COGS values won’t appear in reports unless they are present in the product feed and properly formatted. The item ID in your feed must also match the ID sent with the conversion event. Any mismatch or formatting issue may prevent COGS data from being applied in Google Ads reporting.
Practical Use Case
Let’s say a customer clicks an ad for Product A but ends up purchasing Product B and C instead. With the right setup:
You’ll see which products were actually purchased
Gross profit can be calculated at the item level when COGS is provided
Ad performance can be evaluated based on profitability, not just clicks or revenue
Analyzify ensures that the necessary purchase details are captured accurately, aligned with Google’s Enhanced Conversions requirements, and structured correctly for CwCD-based reporting.
Final Thoughts: Better Data, Better Profitability
Tracking revenue without COGS only gives part of the picture. To understand how your Shopify store is really performing, you need to know how much it costs to sell each product, and how those costs relate to your ad spend and conversion results.
Adding COGS to your product feed and enabling detailed conversion tracking allows you to:
Measure gross profit per item, not just revenue
Make better pricing and budgeting decisions
Optimize ads for what’s actually profitable, not just popular

Standart Tracking Methods Aren't Enough for Shopify
Let Analyzify combine client-side and server-side tracking. So you capture every important event, even when browser script fail.Analyzify helps ensure that your product-level purchase data is captured cleanly and sent to the right platforms, including support for Enhanced Conversions in Google Ads. While it doesn’t calculate COGS, it gives you the infrastructure needed to report on it accurately.