How to import your Facebook Ads cost data into Google Analytics

Importing click and cost data into Google Analytics allows you to track performance across all your marketing channels in one place.

With all your data in Google Analytics, you can see how different marketing channels work together to drive growth for your business.

It also solves duplicate conversion issues where many channels take credit for the same conversion. For example, if a user clicks on your ad through Google Ads and then visits your website through a Facebook ad before converting, each ad platform will attribute a conversion.

By using Google Analytics, you can create a better attribution model to check your marketing performance and address issues like brand and retargeting campaigns taking more credit than they deserve.

What cost data can you upload to Google Analytics?

To upload cost data into Google Analytics, there are certain data fields that you need to include in the file that you import into Google Analytics.

Required

There are the fields you must include when uploading your cost data:

  • Source (utm_source)
  • Medium (utm_medium)
  • Date (ISO 8601: YYYY-MM-DD)
  • Campaign ID (utm_id) — Only for GA4 Properties

At Least One

The obvious selection is Cost, but you still need only include one of the following:

  • Clicks (daily value) (optional)
  • Cost (daily value in the format 0,000.00) (optional, but expected)
  • Impressions (daily value) (optional)

Optional

This means that you can choose to include any of the following data when uploading your information, but it is not required:

  • Referral Path
  • Ad Content
  • Campaign Name
  • Final URL
  • Keyword
  • Search Query

The Problem With Importing Data Manually Into Google Analytics

Google Analytics cannot currently directly import data from Facebook Ads or other advertising platforms that are non-Google. Users must instead import data manually from other services, such as Facebook Ads, Twitter Ads, LinkedIn Ads, and other platforms you may be using.

This process will need to be done regularly, and if you forget to import data or make a mistake, your reports will be based on incomplete data.

How to Import Facebook Cost Data

Setup Facebook Dynamic Parameters for Each Ad (Optional)

Adding UTM parameters manually to each of your ads can be a time-consuming process. The Dynamic URL Parameters Builder makes it easier to automatically inject details from your campaign into your ads.

Facebook Ads supports the following URL dynamic parameters to place on your ads:

  • ad_id = {{ad.id}}
  • adset_id = {{adset.id}}
  • campaign_id = {{campaign.id}}
  • ad_name = {{ad.name}}
  • adset_name = {{adset.name}}
  • campaign_name = {{campaign.name}}
  • placement = {{placement}}
  • site_source_name = {{site_source_name}}

And example of a starter template that can help you get started below. Feel free to modify according to your needs!

utm_source={{site_source_name}}&utm_medium=paid_social&utm_campaign={{campaign.name}}&utm_content={{ad.name}}&utm_id={{campaign.id}}

Read More: https://www.facebook.com/business/help/2360940870872492

Setup a Data Set (Data Source) in Google Analytics for Facebook Ads Data

Google Analytics (Universal Analytics)

  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. This displays the Data Sets page.
  4. Click CREATE.
  5. Select the Data Set Type. (for example, “Cost Data”)
  6. Provide a name for the data source (for example, “Ad Network Data”).
  7. Select one or more Views in which you want to see this data.
  8. Define the Data Set schema by selecting the Key and Target dimensions.
  9. Select the Overwrite behavior.
  10. Click Save.

Read More: https://support.google.com/analytics/answer/6064692

Google Analytics 4 (GA4)

  1. Sign in to Google Analytics
  2. Click on the ‘settings’ icon in the left corner to go to ‘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 Source table
  4. Click the ‘Create Data Source’ button
  5. Name the Data Source
  6. Upload the CSV file you’d like to import into your GA4 property
  7. Match up the ‘Import field’ to the correct ‘Analytics field’
  8. Click ‘Import’

Read More: https://support.google.com/analytics/answer/10071305

Import Data Into Google Analytics (Manually)

This is assuming you followed our Dynamic Parameter section for Facebook Ads. If you’re using your own UTM strategy, it will be the same process, you’ll just need to adjust it for your requirements.

Export Raw Data from Facebook Ads
  1. Go to Facebook Ads Reporting
  2. Select your report date range. This may be “yesterday” if you’re doing a daily import, or “Last 7 days” if weekly.
  3. Select the “Breakdowns” that you need. We’ll use the ones required by Google Analytics that we used for the example Dynamic Parameters template.
    1. Day
    2. Campaign Name (campaign.name)
    3. Campaign ID (campaign.id)
    4. Ad Name (ad.name)
    5. Platform (site_source_name)
  4. Select the “Metrics” that you need. We’ll use the ones required by Google Analytics.
    1. Amount spent
    2. Impressions
    3. Link clicks
  5. Click “Export” button on the top right corner
  6. Select “CSV (.csv)” option
  7. Uncheck “Include summary data”
  8. Click “Export” button
Prepare and Upload Data Into Google Analytics (Universal Analytics)

You’ll need to update the Column names in the exported CSV file, following the format that Google Analytics requires and based on how you setup your Data Set.

Rename column names in CSV export

  1. Day —-> ga:date
  2. Campaign Name —-> ga:campaign
  3. Ad Name —-> ga:adContent
  4. Platform —-> ga:source
    1. Because of the way Facebook appends URL’s to links, you’ll also need to change “facebook” to “fb”, and “instagram” to “id”
  5. Amount spent —-> ga:adCost
  6. Impressions —-> ga:impressions
  7. Link clicks —-> ga:adClicks
  8. Add a new column called ga:medium and as the values, add “paid_social” (or whatever you prefer)

Import prepared CSV file

  1. Go to Settings
  2. Under your property, select “Data Import”
  3. For your data set, click “Manage uploads”
  4. Click “Upload File” and upload your file.
Prepare and Upload Data Into Google Analytics (GA4)

For Google Analytics 4 (GA4), it’ll be a lot each in this section. You can simply upload the file that you downloaded directly from Facebook Ads, and map each column to the correct field.

Import CSV file

  1. Go to Settings
  2. Under your property, click “Data Import”
  3. Click “Create data source”
  4. Give it a name, and select “Cost data” as the Data type
  5. Click “Upload CSV” and map the columns to the the corresponding data field in GA4.

Keep in mind that you’ll need to repeat this process daily, weekly, or monthly, depending on how up to date you need your data to be in Google Analytics.

Import Data Into Google Analytics (Automatically)

Google Analytics (Universal Analytics)

  1. Sign up for an Optimo Analytics account
  2. Connect your Google Analytics property
  3. Connect your Facebook Ads account
    1. Ensure you’ve been added to the Ad Account and have “View performance” access (or higher)
  4. Create a Data Import
  5. Select your Google Analytics property and data set as the Source
  6. Select your Facebook Ads account as the Destination
  7. Save

Google Analytics 4 (GA4)

Currently, there’s no automated way to import data into Google Analytics 4, but as soon as it’s available, we’ll be adding GA4 Properties as a destination in Optimo Analytics and the process will be similar.

Results

Once you have set up the data import(s), you’ll receive data in Google Analytics once a day automatically.

With all the data in one place, use the links below to learn more about using this data to make better decisions that improve the ROI of your marketing spend.

Conclusion

If you’re looking to set up automatic data import for your Facebook Ads campaigns, you can follow our instructions to see the imported cost data in the Cost Analysis report, among others, in Google Analytics.

With Optimo Analytics, you can automatically import data from many data sources – not only Facebook Ads, but also LinkedIn Ads, Twitter Ads, and others.

Author avatar
Aaron
Founder