This article is about Universal Analytics properties, which will stop processing data on July 1, 2023 (October 1, 2023 for Analytics 360 properties). If you haven't already, start using a Google Analytics 4 property.

Cost Data import example

Learn how to import non-Google ad performance data for a "Spring Sale" campaign.

Importing and analyzing 3rd party (non-Google) ad network clicks, cost, and impression data alongside collected Analytics data gives you a more complete picture of your online advertising performance than without this data.

In this article:


Bob is the marketing manager for an online pet store. Bob wants to run a Spring Sale campaign, using keywords purchased from both Google Ads and a non-Google ad network. Bob would like to know how well the keywords on both platforms perform compared to each other. Bob has linked his Google Ads and Analytics accounts, so he automatically gets those metrics in his Analytics reports. But for the non-Google ads, he'll need to upload the click and cost data.

Step One: Tag campaign URLs

Following the guidelines in the Custom Campaigns article, Bob provides tagged URLs to the ad network with his desired Source, Medium, Campaign and Keyword values, such as shown in the example below:

Step Two: Create the Data Set

Bob wants to track clicks, cost and ad impressions for the Spring Sale campaign. He'll need to create a Data Set to hold this data and assign the Data Set to at least one view. Here are the steps to do this:

  1. Sign in to Google Analytics.
  2. Click Admin, and navigate to the property to which you want to upload data.
  3. In the PROPERTY column, click Data Import to display the Data Sets table.
  4. Click the +New Data Set button.
  5. Select the Cost Data type.
  6. Name the Data Set Spring Sale.
  7. Select one or more views to associate with this Data Set.
  8. Define the Data Set schema to include these dimensions and metrics:
    1. Medium
    2. Source
    3. Clicks
    4. Cost
  9. Click Save.
  10. Click Get Schema and copy the Data Set schema for use in Step Four below.

The schema consists of a Key (one or more dimensions and/or metrics used to match uploaded data to existing hits) and one or more imported dimensions and/or metrics, which hold the additional data you are uploading.

Learn more about Data Set schemas.

Step Three: Download the data

After the Spring sale campaign has run for a few days, Bob uses an export tool provided by the ad network to download aggregated daily data and saves it as a CSV file. The example below shows a few lines from that file:

Date,Campaign Name,Keyword,Impressions,Clicks,Spend
6/11/2014,Spring Sale,dogbone,9387,288,100.3     
6/11/2014,Spring Sale,dog treats,1684,52,19.35
6/11/2014,Spring Sale,pet store,3187,143,76.23
6/12/2014,Spring Sale,dogbone,10005,356,121.67 
6/12/2014,Spring Sale,dog treats,1534,68,25.16
6/12/2014,Spring Sale,pet store,3398,201,80

As fascinating as this data is, the file needs a few changes:

  • The column headers provided by the ad network don't match the names expected by Analytics.
  • The Source and Medium dimensions are missing.
  • The date format should be in YYYYMMDD style.

Bob will need to fix these issues before he can upload the data.

If you are using Google Sheets to format your CSV file, you can use the custom number format feature to output the date field in yyyyMMdd format. Learn more about formatting numbers and dates.

Step Four: Modify the CSV

Bob opens the CSV in his favorite spreadsheet program file and modifies it to meet the format required by Analytics. Specifically, he changes the column headers to match the Analytics dimension and metric names, adds the missing dimensions and values, and changes the date format. His data now looks like this:

The CSV file is now ready to be uploaded to Analytics. Bob saves it as "adnetwork_springsale_2014-09-12.csv".

Step Five: Upload the data to Analytics

Upload cost data using the web interface

Bob returns to his Analytics account and displays the Manage Uploads page for data set that holds the Spring Sale cost data by:

  1. Clicking Admin in the menu bar at the top of any page.
  2. In the ACCOUNT column, selecting the Analytics account that contains the parent property for the data set.
  3. In the PROPERTY column, selecting the property that contains the data set.
  4. Clicking Data Import. This displays the Data Sets table.
  5. Clicking the Manage Uploads link for the Spring Sale data set.
  6. Clicking the Upload file button.

Bob has been careful to make sure his uploaded data file is formatted correctly, so the upload succeeds. (However, if there had been an error, Bob would see that reflected in the Status column of the uploads table.)

Upload cost data using the Management API

Bob can also upload his cost data using the Management API.

Step Six: See the data in reports

Phew! Bob can finally see how his ad network keywords are performing by running the Cost Analysis Report. This report shows visit, cost, and revenue performance data for your paid marketing channels. Bob can also create custom reports using his uploaded data.

Uploaded data needs to be processed and joined with your existing data. It may take up to 24 hours before the imported data appears in reports.

Was this helpful?
How can we improve it?
Clear search
Close search
Google apps
Main menu
Search Help Center