Import Data into GA4: External Shopify App Cost Example

Updated on 2025-02-05

Why would you want to import data into Google Analytics 4? We all know that GA4 collects behavior data regardless of the traffic channel that brings visitors to your website. But these traffic channels often cost you money, and if they are not Google advertising, it's not possible to see what you spent to bring that traffic i.e. you can not calculate the profitability of a particular channel.

To solve this, GA4 introduced a convenient way to manually import cost data, allowing you to assign a monetary value to a particular traffic channel. This feature enables better Return on Ad Spend (ROAS) calculations and cross-platform performance comparisons.

In this guide we’ll walk through a step-by-step process of importing cost data into GA4, troubleshoot common issues, and explore how this data enhances your reporting.

Understanding External Data Import in GA4

GA4’s cost data import allows you to upload costs incurred on platforms that don’t have a native integration with GA4, such as Facebook Ads, ShopApp Ads, TikTok Ads or any other channel. In this example we’ll focus on importing the cost of Tapcart App, so we can analyze the profitability of that channel.

Note that Littledata GA4 integration allows you to properly attribute revenue in GA4 to an external Shopify App (such as Tapcart). You can import cost data for a good ol' Facebook campaign as well, applying the method that will be described in the following text.

List of GA4 Imported Ad Cost Metrics

In the Google Analytics official data import help article you can find an example csv file - a template for data import.

Here's how the template looks:

You can notice that column names define information that can be imported. To measure the performance of your external marketing spend, GA4 allows you to import the following key metrics:

  • Source (in this case Tapcart app, could be facebook, tiktok etc)
  • Medium (cpc, paid_video, display etc)
  • Campaign id and name (optional: e.g influencer_xyz or spring_sale)
  • Date (when the cost occurred)
  • Clicks
  • Impressions
  • Cost

Please note that out of the three metrics, at least one is obligatory - here's the screenshot from the GA4 import process:

Once the data is imported, it gets matched with behavior metrics as well as conversions and revenue inside GA4 to help marketers evaluate campaign effectiveness and calculate ROAS across all traffic sources. The import works retroactively meaning that you can enrich any existing traffic in GA4 with monetary value.

Preparing Your Data for Import

Before uploading cost data, you need to format your CSV file properly to match GA4’s schema.

The fields in the example csv provided by Google are:

Campaign ID Campaign name Source Medium Date (YYYY-MM-DD format) Impressions Clicks Cost

NB: Campaign ID and Campaign Name are no longer required fields (as of early 2025).

Common Issues to Avoid

  • Incorrect date format → Ensure the date is in YYYY-MM-DD format. I you’re using the template csv provided by Google official docs - make sure to fix this, other wise you'll bang your head around this error:

  • Missing columns → Even if a metric isn’t available, keep the column headers in place!
  • Mismatch between GA4 and imported source/medium → Ensure the naming is identical to how GA4 reports traffic, a simple typo will cause a lot of frustration because it's hard to spot!

Creating a Data Source in GA4

Now that you’ve prepared your data, let’s create a cost data import source inside GA4. Go to Admin → Data Import

Click Create Data Source, select the cost data CSV file, name your source and click Next

In the next step you get to map the fields, and once you’re done click Import

Troubleshooting Tips: Common Errors & Fixes

💡 Error: "Invalid Date Detected" ✔️ Solution: Go back to your CSV and ensure the date format is YYYY-MM-DD. Reformat if needed and re-upload.

💡 Error: "Missing Required Field" ✔️ Solution: Ensure all column headers are correctly spelled and included in the CSV. Even if you don’t have clicks/impressions, keep the column headers.

💡 Error: "Duplicate Data Detected" ✔️ Solution: Make sure you don’t upload the same data twice for the same date range.

💡 Error: "File Formatting Issue" ✔️ Solution: Save the file as a CSV UTF-8 (comma-separated values) format.

How to analyze the imported data

Once the import is successful, you can immediately view the cost data in GA4’s reports and combine it with purchase data. Create a New Exploration and add Session source/medium dimension and all the Non Google ads metrics from the following screenshot:

Analyze return and cost per acquisition for external sources - in this example, an e-commerce store is driving revenue from an external Shopify app called Tapcart at a superb ROAS:

In GA4, we see the high performing Tapcart channel:

  • just above 2,700 purchases from this app
  • close to $215,000 revenue generated
  • External cost data imported correctly and it shows an astonishing ROAS of 344!

By importing ad cost data, GA4 now calculates ROAS (Revenue / Ad Spend) directly in reports, allowing better budget allocation and performance evaluation for non-Google ad platforms.

Conclusion

Once you start importing cost data into GA4, you'll gain a full picture of your marketing spend and efficiency, especially for non-Google ad platforms like Facebook, TikTok, and LinkedIn. This process helps you:

  • Measure ROI across all traffic sources
  • Calculate ROAS directly in GA4
  • Improve budget decisions with real ad spend data

Start importing your ad cost data today and get better insights into your marketing performance! Happy analyzing! 🎯