How to Create an Income and Expense Report in Google Analytics
Seeing your marketing spend next to the revenue it generates is the holy grail of analytics, yet Google Analytics doesn't make it straightforward. By default, it excels at tracking website income through its e-commerce features but remains silent on the expense side. This article will show you exactly how to import your advertising cost data into Google Analytics 4 and build a unified income and expense report to get a true picture of your return on investment.
Why Bother Creating an Income and Expense Report in GA4?
Connecting your costs to your revenue data inside one platform isn't just a technical exercise, it fundamentally changes how you make strategic decisions. It moves your analysis from vanity metrics to raw profitability.
When you have this report, you can easily answer critical business questions:
Which marketing channels have the best return on investment (ROI)? You can see if that flashy Facebook Ads campaign is actually profitable or if your steady, low-cost organic search traffic is generating a better ROI.
Are my individual campaigns profitable? Go beyond channel-level analysis and drill down into specific campaigns. You might discover that one ad creative is a cash cow while another is burning your budget with no return.
How should I adjust my marketing budget? With a clear view of profit-per-channel, you can confidently reallocate funds from underperforming campaigns to the ones that are proven to work, maximizing your overall marketing impact.
In short, it’s about moving from "we're getting a lot of clicks" to "we're making a profit on every dollar spent here."
Step 1: Get Your Expense Data Ready for Import
Before you can bring anything into Google Analytics, you need to prepare a clean data file. GA4 imports data via a CSV (Comma-Separated Values) file. The goal is to create a spreadsheet with your daily advertising costs, broken down by source, medium, and campaign.
Most ad platforms, like Facebook Ads, LinkedIn Ads, or Microsoft Ads, have an export or reporting feature where you can download your performance data. Google Ads costs are imported automatically if your accounts are properly linked, so you'll primarily be doing this for non-Google channels.
Formatting Your CSV File
GA4 is strict about the format of your cost data file. Your spreadsheet must have specific column headers for it to work. You don't need all possible columns, but you absolutely must have a date and at least one cost metric, plus the campaign-level identifiers.
Here are the essential headers you’ll need:
date: The date of the spend in YYYY-MM-DD format (e.g., 2024-08-21).campaign_id: The unique ID you use for your campaign (required). You can also use the campaign name.source: The UTM source tag (e.g., 'facebook', 'linkedin').medium: The UTM medium tag (e.g., 'cpc', 'social-paid').cost: The amount spent on that day for that campaign. Do not include currency symbols.
You can also include columns for clicks and impressions if you want to import that data as well. These campaign, source, and medium values must match the UTM parameters you're using in the destination URLs for your ads. This is how Google Analytics connects the ad spend you’re importing to the user sessions it tracks on your website.
Your finished CSV might look something like this:
date,campaign_id,source,medium,cost,clicks 2024-08-21,fall-promo-2024,facebook,cpc,150.75,210 2024-08-21,lead-gen-q3,linkedin,cpc,75.20,88 2024-08-22,fall-promo-2024,facebook,cpc,145.30,198
Create a separate CSV for each ad platform you want to import data from. Keeping them separate makes troubleshooting much easier if you run into any errors during the import process.
Step 2: Importing Your Cost Data into Google Analytics
With your perfectly formatted CSV in hand, it’s time to upload it to GA4. This is done through a feature called "Data Import."
Creating a New Data Source
Follow these steps to set up a new source for your expense data:
In your GA4 property, navigate to the Admin panel by clicking the gear icon at the bottom-left.
Under the 'Data display' column, click on Data Import.
Click the blue Create data source button.
Give your data source a name. It’s a good practice to name it after the ad platform you’re importing, for example, "Facebook Cost Data" or "LinkedIn Ad Spend."
For 'Data type', select Cost Data.
You will now see a prompt to upload your file. Click the Upload file link and select the CSV you prepared earlier.
Mapping Your Data
Once your file is uploaded, Google will try to automatically map your CSV column headers to its own fields. If your headers match theirs exactly, this should happen seamlessly. If not, you’ll need to manually connect them.
You’ll see two columns: 'GA4 field' and 'Importing file's field'. Ensure that:
utm_sourcein GA4 maps to yoursourcecolumn.utm_mediumin GA4 maps to yourmediumcolumn.utm_campaignin GA4 maps to yourcampaign_idor equivalent campaign column.Costin GA4 maps to yourcostcolumn.Datein GA4 maps to yourdatecolumn.
If you included them, also map Clicks and Impressions.
Finally, choose your 'Import Behavior' – usually, Overwrite is the best option here. If you upload data for a date that data has already been imported from, Overwrite ensures the new data replaces it entirely — useful if you need to fix or update existing values. Once everything looks right, click the Import button in the top-right corner. It may take up to 24 hours for the data to be processed and appear in your reports.
Step 3: Building Your Income & Expense Report in Explore
Once your cost data has been successfully processed, you can build a custom report to see everything together. The standard GA4 reports won't show third-party cost and revenue side-by-side, so you need to head over to the Explore section.
Setting Up a New Exploration
In the left-hand navigation, click on Explore.
Start a new exploration by clicking on the Blank template.
Give your exploration a helpful name, like "Campaign ROI Analysis."
Adding Dimensions and Metrics
The "Exploration" tool has three main panes: Variables, Tab Settings, and the report canvas on the right. In the Variables pane, you need to import the data dimensions and metrics you want to use.
Dimensions: Click the '+' button next to 'Dimensions'. Search for and import "Session source / medium," "Session campaign," and any others you might find useful, like "Device category."
Metrics: Click the '+' button next to 'Metrics'. Search for and import "Cost," "Total revenue," "Purchase revenue," "Sessions," "Transactions," and "Conversions." 'Cost' is the metric created from your data import.
Configuring Your Report
Now, drag and drop your selected dimensions and metrics from the 'Variables' pane into the 'Tab Settings' pane to build your report:
Drag Session campaign into the 'Rows' box in Tab Settings.
Drag Session source / medium into the 'Columns' box. This creates a pivot table, but for a simpler view, you can just drag both into 'Rows.'
Drag Sessions, Cost, Transactions, and Total revenue into the 'Values' box.
Instantly, the canvas on the right will populate with a table showing your campaign performance. You'll see your website sessions, the associated ad cost you imported, and the transaction revenue GA4 has tracked for those same campaigns, all in one place!
Bonus Step: Calculating Profit and ROI with Custom Metrics
Seeing cost next to revenue is great, but calculating profitability on the fly is even better. The GA4 Explore tool lets you create calculated metrics to do just this.
Within the 'Variables' pane, below 'Metrics', you'll see a 'Calculated metrics' section.
Create a "Profit" Metric
Click the '+' button next to Calculated Metrics.
Name your metric "Profit."
In the formula box, type:
{Total revenue} - {Cost}. Just start typing the metric names and GA4 will let you select them from a list.Set the formatting type to 'Currency (Decimal)'.
Click Save.
Create an "ROI" Metric
Create another new calculated metric and name it "ROI."
In the formula box, type:
({Total revenue} - {Cost}) / {Cost}.Set the formatting type to 'Percent'.
Click Save.
Now you have 'Profit' and 'ROI' available as metrics. Drag them into the 'Values' section of your Tab Settings. Your report is now a fully-featured profitability dashboard, showing you exactly which campaigns are making money and which are losing it.
Final Thoughts
Bringing your expense data into Google Analytics to build a comprehensive income and expense report unlocks a deeper level of analysis. By combining costs with revenue, you can directly calculate ROI and make data-driven decisions on budget allocation, turning GA4 into a powerful tool for measuring campaign profitability across your entire marketing stack.
While this process provides massive value, it still requires manual work — downloading, formatting, and re-uploading spreadsheets every week or month. This is where we built Graphed to help. We connect directly to your data sources like Facebook Ads, Shopify, and Google Analytics, automating this whole process. You can use a simple chat prompt to instantly build a real-time profitability dashboard without ever touching a CSV file again, centralizing your income and expense data once and for all.