How to setup a data import for Facebook Ads

Setup a daily automated import of Facebook Ads cost data into your Google Analytics property.

Connect a Facebook Ad Account #

  1. Go to setup to be able to connect an account
  2. Then click on Facebook to view all Ad Accounts connected, as well as be able to connect a new account
  3. Click on “Add New Account”
  4. Select the Business Manager and then the Facebook Ad account you want to connect and save.

Create a Data Import #

  1. While still logged in, go to “Google Analytics Data Import
  2. Click on “New Data Import”
  3. Enter a name for the Data Import you’re creating
  4. Source: The Facebook Ad Account you want to send the cost data from
  5. Destination: The Google Analytics property you want to send the data to
  6. Data Set: The data set you created specifically for your Facebook Ads cost data
  7. Click “Save”

Create Data Import in Google Analytics #

  1. Admin > Data collection and modification > Data import
  2. Click on “Create data source”.
  3. Name the data source, Data type is set to “Cost Data”, and Upload data for import is “SFTP”.
  4. Copy the SFTP username and Server URL from the data import you created in Optimo Analytics and paste it in Google Analytics.
  5. Schedule set to Daily, and Start time can be what you prefer the cutoff of the data to be.
  6. When setting up the Mapping, rename the import fields correctly and check Daily cost, Daily clicks, and Daily impressions.
    • utm_id
    • utm_source
    • utm_medium
    • utm_campaign
    • date
    • cost
    • clicks
    • impressions
  7. Click button “Create & generate key”.
  8. Copy the Public Key that’s generated by Google Analytics, and paste it in the data import you Optimo Analytics data import.
  9. Click Save.

Setup Your UTM Tags in Facebook #

When you look into your ad details, you will see a section called Tracking, where you’ll see a field called URL Parameters ∙ Optional.

We currently only support the following Dynamic Parameters to be used for the UTM parameters for Source, Medium, Campaign, or Content (with plans to support the rest):

  • 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}}

We’ve included below a UTM parameter structure to get you started. Just copy & paste the code below for all your Facebook and Instagram ads.

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

If you’d like to customize the UTM parameter structure, see the documentation here which shows all the available variables Facebook has available.

Read our complete article here: https://optimoanalytics.com/blog/how-to-import-your-facebook-ads-cost-data-into-google-analytics/