Setup a daily automated import of Facebook Ads cost data into your Google Analytics property.
Connect a Facebook Ad Account #
- Go to setup to be able to connect an account
- Then click on Facebook to view all Ad Accounts connected, as well as be able to connect a new account
- Click on “Add New Account”
- Select the Business Manager and then the Facebook Ad account you want to connect and save.
Create a Data Import #
- While still logged in, go to “Google Analytics Data Import“
- Click on “New Data Import”
- Enter a name for the Data Import you’re creating
- Source: The Facebook Ad Account you want to send the cost data from
- Destination: The Google Analytics property you want to send the data to
- Data Set: The data set you created specifically for your Facebook Ads cost data
- Click “Save”
Create Data Import in Google Analytics #
- Admin > Data collection and modification > Data import
- Click on “Create data source”.
- Name the data source, Data type is set to “Cost Data”, and Upload data for import is “SFTP”.
- Copy the SFTP username and Server URL from the data import you created in Optimo Analytics and paste it in Google Analytics.
- Schedule set to Daily, and Start time can be what you prefer the cutoff of the data to be.
- 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
- Click button “Create & generate key”.
- Copy the Public Key that’s generated by Google Analytics, and paste it in the data import you Optimo Analytics data import.
- 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/