How to Import Cost Data with the GA4 SFTP Method

Written by: EasyAutoTagging Staff Read time 5 minutes

One way to enhance your reporting in GA4 is by importing cost data via the GA4 SFTP Method. You can import cost data manually via the CSV method or through the SFTP (Secure File Transfer Protocol) method. The SFTP method allows you to combine your marketing costs with GA4 data, which can help businesses better understand the ROI of their marketing campaigns.

In this blog post, we’ll walk you through the steps of importing cost data via SFTP so that you can measure ROI in GA4.

Note: You can learn how to import cost data via the CSV method here. 

Step 1: Create a Data Source

The first step to importing cost data into GA4 is to create a data source. In GA4, a data source is a collection of data that shares the same characteristics, such as cost data or offline event data. 

To create a data source, log in to your GA4 account, navigate to the “Admin” section, and click on “Data Import” in the Properties column. 

GA4 > Admin > Cost Data Import

From there, select the data stream you want to import cost data for and click on “Create data source.”

GA4 Create Data Source

Give the data a descriptive name, select “Cost data” as your data type, and select SFTP for your import source.

Cost data import type

Step 2: Configure your GA4 SFTP server

Note: You can automate cost data imports via the SFTP method without having to configure your own SFTP server via EasyAutoTagging. Learn more about our Google Analytics 4 (GA4) Beta release here.

Once you’ve created a data source, the next step is to configure your SFTP server. Configuring an SFTP server for GA4 cost data imports involves the following steps:

  1. Choose an SFTP server: You can use any SFTP server that supports SSH authentication. Some popular options are OpenSSH, FileZilla Server, and ProFTPD.
  2. Set up an SFTP user account: Create an SFTP user account that will be used to upload the cost data files. Make sure to give the user account appropriate permissions to access the directories where the cost data files will be stored.
  3. Set up the SFTP server: Configure the SFTP server to accept incoming connections from your GA4 account’s IP address(es). You may need to consult your SFTP server’s documentation to learn how to do this.
  4. Generate an SSH key pair: Generate an SSH key pair that will be used to authenticate the SFTP user account. You can use a tool like PuTTYgen to generate the key pair.
  5. Share the public key with Google: Share the public key with Google by adding it to your GA4 account’s SSH key list. This will allow Google to authenticate the SFTP user account and upload the cost data files.

Once you have completed these steps, you should be able to configure your GA4 account to import cost data from the SFTP server. To complete the set up paste your SFTP server username and SFTP url into their respective fields.

GA4 SFTP Method username and url

Select your cost data import schedule and click “Next.”

GA4 SFTP Method import schedule

GA4 will generate a Test the connection: Test the connection by uploading a test cost data file to the SFTP server using the SFTP user account. Make sure that the file is uploaded to the correct directory and that it can be read by Google.

Note: The exact steps to do this will depend on the specific tools and services that you are using. You may need to consult the documentation for your SFTP server and your GA4 account for more detailed instructions.

Step 3: Map Cost Data Import Fields

The final step is to map your cost data import fields. In this step make sure to select cost, impression and clicks and add them to the mapped fields.

Map Fields for your GA4 Data Source

Next click on “Create and generate key” in the top right corner and authorize the public key on your SFTP server.

GA4 SFTP Method Public Key

Step 4: Verify and Adjust your GA4 SFTP Method

Once you’ve set up the cost data import, it’s important to verify that the data is being imported correctly. To do this, create a custom report in explorations and pull the campaign dimension and non-google cost, impression, click, cost per click, and return on non-google ad spend metrics.

Custom GA4 Exploration Report


Importing cost data into GA4 can help businesses better understand the ROI of their marketing campaigns. By following the steps outlined in this blog, you can create a data source, choose a data source, configure your SFTO server, and verify and adjust the data to ensure its accuracy. With cost data at your fingertips in GA4, you can make more informed decisions about your marketing budget and improve campaign performance.


The EasyAutoTagging staff is made up of seasoned pros in digital marketing, marketing analytics, and ad tech. They’ve brought a wealth of experience and hands-on knowledge to our blog and help documentation over the years. From in-depth articles on the latest industry trends to easy-to-follow guides. You can explore more of their articles here.

Leave a comment

Your email address will not be published. Required fields are marked *