# Facebook Ads

### Snapshot

| Features                                | Details                                                            |
| --------------------------------------- | ------------------------------------------------------------------ |
| Release Status                          | Released                                                           |
| Source API Version                      | v3.3                                                               |
| Table Selection                         | Yes                                                                |
| Column Selection                        | Yes                                                                |
| Edit Integration                        | Yes                                                                |
| Replication Type Selection              | No                                                                 |
| Authentication Parameters               | <p>Facebook Ads account email<br>Facebook Ads account password</p> |
| Replication Type: Key Based Incremental | Replication Key: Date                                              |
| Suggested Replication Frequency: 24 hrs |                                                                    |

| Tables/APIs Supported      |                                   |
| -------------------------- | --------------------------------- |
| Insights                   | Ads                               |
| Campaigns                  | AdCreatives                       |
| AdInsightsBreakdownCountry | AdInsightsBreakdownRegion         |
| AdInsightsBreakdownGender  | AdInsightsBreakdownDevicePlatform |

### Integrate Facebook Ads with Daton

1. Signin to Daton&#x20;
2. Select Facebook Ads from Integrations page
3. Provide Integration Name, Replication Frequency, and History. Integration name would be used in creating tables for the integration and cannot be changed later&#x20;
4. You will be redirected to Facebook Ads login for authorizing Daton to extract data periodically
5. Post successful authentication, you will be prompted to choose from the list of available Facebook Ad accounts
6. Select required tables from the available list of tables
7. Then select all required fields for each table
8. Submit the integration

### Workflow

1. Integrations would be in Pending state initially and will be moved to Active state as soon as the first job loads data successfully on to the configured warehouse
2. Users would be able to edit/pause/re-activate/delete integration anytime
3. Users can view job status and process logs from the integration details page by clicking on the integration name from the active list

### Facebook Ads Data

**Insights**

Purpose: Provides interface to retrive data related to ads.

Source API Documentation  <https://developers.facebook.com/docs/marketing-api/reference/adgroup/insights/v3.3>

Replication: Key-Based Replication

Replication Key: lastRunDate

**Fields**

| Name                                   | Target Datatype |
| -------------------------------------- | --------------- |
| account\_currency                      | STRING          |
| account\_id                            | STRING          |
| account\_name                          | STRING          |
| action\_values                         | RECORD          |
| ad\_id                                 | STRING          |
| ad\_name                               | STRING          |
| adset\_id                              | STRING          |
| adset\_name                            | STRING          |
| buying\_type                           | STRING          |
| campaign\_id                           | STRING          |
| campaign\_name                         | STRING          |
| canvas\_avg\_view\_percent             | NUMERIC         |
| clicks                                 | NUMERIC         |
| cost\_per\_estimated\_ad\_recallers    | NUMERIC         |
| cost\_per\_inline\_link\_click         | NUMERIC         |
| cost\_per\_inline\_post\_engagement    | NUMERIC         |
| cost\_per\_unique\_click               | NUMERIC         |
| cost\_per\_unique\_inline\_link\_click | NUMERIC         |
| cpc                                    | NUMERIC         |
| cpm                                    | NUMERIC         |
| cpp                                    | NUMERIC         |
| ctr                                    | NUMERIC         |
| date\_start                            | STRING          |
| date\_stop                             | STRING          |
| estimated\_ad\_recall\_rate            | NUMERIC         |
| estimated\_ad\_recallers               | NUMERIC         |
| frequency                              | NUMERIC         |
| impressions                            | NUMERIC         |
| inline\_link\_clicks                   | NUMERIC         |
| inline\_post\_engagement               | NUMERIC         |
| objective                              | STRING          |
| reach                                  | NUMERIC         |
| social\_spend                          | NUMERIC         |
| spend                                  | NUMERIC         |
| unique\_clicks                         | NUMERIC         |
| unique\_ctr                            | NUMERIC         |
| unique\_inline\_link\_click\_ctr       | NUMERIC         |
| unique\_inline\_link\_clicks           | NUMERIC         |
| website\_ctr                           | RECORD          |

**Ads**

Purpose: Ads object has the necessary data of each ad. Each Ad is linked with an corresponding adset.

Source API Documentation  <https://developers.facebook.com/docs/marketing-api/reference/adgroup>

Replication: Key-Based Replication

Replication Key: lastRunRecordDate

**Fields**

| Name               | Target Datatype |
| ------------------ | --------------- |
| id                 | STRING          |
| account\_id        | STRING          |
| adlabels           | RECORD          |
| adset\_id          | STRING          |
| bid\_amount        | NUMERIC         |
| campaign\_id       | STRING          |
| configured\_status | STRING          |
| created\_time      | STRING          |
| name               | STRING          |
| source\_ad\_id     | STRING          |
| status             | STRING          |
| creative           | RECORD          |

**Campaigns**

Purpose: A campaign is a grouping of ad sets which are organized by the same business objective. Each campaign has an objective that must be valid across the ad sets within that campaign.

Source API Documentation  <https://developers.facebook.com/docs/marketing-api/reference/ad-campaign-group>

Replication: Key-Based Replication

Replication Key: lastRunRecordDate

**Fields**

| Name              | Target Datatype |
| ----------------- | --------------- |
| id                | STRING          |
| account\_id       | STRING          |
| adlabels          | RECORD          |
| name              | STRING          |
| objective         | STRING          |
| effective\_status | STRING          |
| buying\_type      | STRING          |
| spend\_cap        | STRING          |
| start\_time       | STRING          |
| updated\_time     | STRING          |

**AdCreatives**

Purpose: Adcreatives table consists information of the layout and content for the ad.

Source API Documentation  <https://developers.facebook.com/docs/marketing-api/reference/ad-creative>

Replication: Key-Based Replication

Replication Key: AdAccount

**Fields**

| Name                            | Target Datatype |
| ------------------------------- | --------------- |
| body                            | STRING          |
| image\_url                      | STRING          |
| id                              | STRING          |
| account\_id                     | STRING          |
| actor\_id                       | STRING          |
| applink\_treatment              | STRING          |
| call\_to\_action\_type          | STRING          |
| effective\_instagram\_story\_id | STRING          |
| effective\_object\_story\_id    | STRING          |
| title                           | STRING          |
| name                            | STRING          |
| instagram\_permalink\_url       | STRING          |
| instagram\_story\_id            | STRING          |
| link\_og\_id                    | STRING          |
| object\_id                      | STRING          |
| object\_story\_id               | STRING          |
| object\_type                    | STRING          |
| object\_url                     | STRING          |
| product\_set\_id                | STRING          |
| status                          | STRING          |
| template\_url                   | STRING          |
| thumbnail\_url                  | STRING          |
| image\_hash                     | STRING          |
| url\_tags                       | STRING          |
| video\_id                       | STRING          |
| link\_url                       | STRING          |

**AdInsightsBreakdownCountry**

Purpose: Provides interface to retrive data related to ads divided using breakdown country.

Source API Documentation  <https://developers.facebook.com/docs/marketing-api/reference/adgroup/insights/v3.3>

Replication: Key-Based Replication

Replication Key: lastRunDate

**Fields**

| Name                                   | Target Datatype |
| -------------------------------------- | --------------- |
| account\_currency                      | STRING          |
| account\_id                            | STRING          |
| account\_name                          | STRING          |
| action\_values                         | RECORD          |
| ad\_id                                 | STRING          |
| ad\_name                               | STRING          |
| adset\_id                              | STRING          |
| adset\_name                            | STRING          |
| buying\_type                           | STRING          |
| campaign\_id                           | STRING          |
| campaign\_name                         | STRING          |
| canvas\_avg\_view\_percent             | NUMERIC         |
| clicks                                 | NUMERIC         |
| cost\_per\_estimated\_ad\_recallers    | NUMERIC         |
| cost\_per\_inline\_link\_click         | NUMERIC         |
| cost\_per\_inline\_post\_engagement    | NUMERIC         |
| cost\_per\_unique\_click               | NUMERIC         |
| cost\_per\_unique\_inline\_link\_click | NUMERIC         |
| cpc                                    | NUMERIC         |
| cpm                                    | NUMERIC         |
| cpp                                    | NUMERIC         |
| ctr                                    | NUMERIC         |
| date\_start                            | STRING          |
| date\_stop                             | STRING          |
| estimated\_ad\_recall\_rate            | NUMERIC         |
| estimated\_ad\_recallers               | NUMERIC         |
| frequency                              | NUMERIC         |
| impressions                            | NUMERIC         |
| inline\_link\_clicks                   | NUMERIC         |
| inline\_post\_engagement               | NUMERIC         |
| objective                              | STRING          |
| reach                                  | NUMERIC         |
| social\_spend                          | NUMERIC         |
| spend                                  | NUMERIC         |
| unique\_clicks                         | NUMERIC         |
| unique\_ctr                            | NUMERIC         |
| unique\_inline\_link\_click\_ctr       | NUMERIC         |
| unique\_inline\_link\_clicks           | NUMERIC         |
| website\_ctr                           | RECORD          |

**AdInsightsBreakdownRegion**

Purpose: Provides interface to retrive data related to ads divided using breakdown Region.

Source API Documentation  <https://developers.facebook.com/docs/marketing-api/reference/adgroup/insights/v3.3>

Replication: Key-Based Replication

Replication Key: lastRunDate

**Fields**

| Name                                   | Target Datatype |
| -------------------------------------- | --------------- |
| account\_currency                      | STRING          |
| account\_id                            | STRING          |
| account\_name                          | STRING          |
| action\_values                         | RECORD          |
| ad\_id                                 | STRING          |
| ad\_name                               | STRING          |
| adset\_id                              | STRING          |
| adset\_name                            | STRING          |
| buying\_type                           | STRING          |
| campaign\_id                           | STRING          |
| campaign\_name                         | STRING          |
| canvas\_avg\_view\_percent             | NUMERIC         |
| clicks                                 | NUMERIC         |
| cost\_per\_estimated\_ad\_recallers    | NUMERIC         |
| cost\_per\_inline\_link\_click         | NUMERIC         |
| cost\_per\_inline\_post\_engagement    | NUMERIC         |
| cost\_per\_unique\_click               | NUMERIC         |
| cost\_per\_unique\_inline\_link\_click | NUMERIC         |
| cpc                                    | NUMERIC         |
| cpm                                    | NUMERIC         |
| cpp                                    | NUMERIC         |
| ctr                                    | NUMERIC         |
| date\_start                            | STRING          |
| date\_stop                             | STRING          |
| estimated\_ad\_recall\_rate            | NUMERIC         |
| estimated\_ad\_recallers               | NUMERIC         |
| frequency                              | NUMERIC         |
| impressions                            | NUMERIC         |
| inline\_link\_clicks                   | NUMERIC         |
| inline\_post\_engagement               | NUMERIC         |
| objective                              | STRING          |
| reach                                  | NUMERIC         |
| social\_spend                          | NUMERIC         |
| spend                                  | NUMERIC         |
| unique\_clicks                         | NUMERIC         |
| unique\_ctr                            | NUMERIC         |
| unique\_inline\_link\_click\_ctr       | NUMERIC         |
| unique\_inline\_link\_clicks           | NUMERIC         |
| website\_ctr                           | RECORD          |

**AdInsightsBreakdownGender**

Purpose: Provides interface to retrive data related to ads divided using breakdown Gender.

Source API Documentation  <https://developers.facebook.com/docs/marketing-api/reference/adgroup/insights/v3.3>

Replication: Key-Based Replication

Replication Key: lastRunDate

**Fields**

| Name                                   | Target Datatype |
| -------------------------------------- | --------------- |
| account\_currency                      | STRING          |
| account\_id                            | STRING          |
| account\_name                          | STRING          |
| action\_values                         | RECORD          |
| ad\_id                                 | STRING          |
| ad\_name                               | STRING          |
| adset\_id                              | STRING          |
| adset\_name                            | STRING          |
| buying\_type                           | STRING          |
| campaign\_id                           | STRING          |
| campaign\_name                         | STRING          |
| canvas\_avg\_view\_percent             | NUMERIC         |
| clicks                                 | NUMERIC         |
| cost\_per\_estimated\_ad\_recallers    | NUMERIC         |
| cost\_per\_inline\_link\_click         | NUMERIC         |
| cost\_per\_inline\_post\_engagement    | NUMERIC         |
| cost\_per\_unique\_click               | NUMERIC         |
| cost\_per\_unique\_inline\_link\_click | NUMERIC         |
| cpc                                    | NUMERIC         |
| cpm                                    | NUMERIC         |
| cpp                                    | NUMERIC         |
| ctr                                    | NUMERIC         |
| date\_start                            | STRING          |
| date\_stop                             | STRING          |
| estimated\_ad\_recall\_rate            | NUMERIC         |
| estimated\_ad\_recallers               | NUMERIC         |
| frequency                              | NUMERIC         |
| impressions                            | NUMERIC         |
| inline\_link\_clicks                   | NUMERIC         |
| inline\_post\_engagement               | NUMERIC         |
| objective                              | STRING          |
| reach                                  | NUMERIC         |
| social\_spend                          | NUMERIC         |
| spend                                  | NUMERIC         |
| unique\_clicks                         | NUMERIC         |
| unique\_ctr                            | NUMERIC         |
| unique\_inline\_link\_click\_ctr       | NUMERIC         |
| unique\_inline\_link\_clicks           | NUMERIC         |
| website\_ctr                           | RECORD          |

**AdInsightsBreakdownDevicePlatform**

Purpose: Provides interface to retrive data related to ads divided using breakdown Device Platform.

Source API Documentation  <https://developers.facebook.com/docs/marketing-api/reference/adgroup/insights/v3.3>

Replication: Key-Based Replication

Replication Key: lastRunDate

**Fields**

| Name                                   | Target Datatype |
| -------------------------------------- | --------------- |
| account\_currency                      | STRING          |
| account\_id                            | STRING          |
| account\_name                          | STRING          |
| action\_values                         | RECORD          |
| ad\_id                                 | STRING          |
| ad\_name                               | STRING          |
| adset\_id                              | STRING          |
| adset\_name                            | STRING          |
| buying\_type                           | STRING          |
| campaign\_id                           | STRING          |
| campaign\_name                         | STRING          |
| canvas\_avg\_view\_percent             | NUMERIC         |
| clicks                                 | NUMERIC         |
| cost\_per\_estimated\_ad\_recallers    | NUMERIC         |
| cost\_per\_inline\_link\_click         | NUMERIC         |
| cost\_per\_inline\_post\_engagement    | NUMERIC         |
| cost\_per\_unique\_click               | NUMERIC         |
| cost\_per\_unique\_inline\_link\_click | NUMERIC         |
| cpc                                    | NUMERIC         |
| cpm                                    | NUMERIC         |
| cpp                                    | NUMERIC         |
| ctr                                    | NUMERIC         |
| date\_start                            | STRING          |
| date\_stop                             | STRING          |
| estimated\_ad\_recall\_rate            | NUMERIC         |
| estimated\_ad\_recallers               | NUMERIC         |
| frequency                              | NUMERIC         |
| impressions                            | NUMERIC         |
| inline\_link\_clicks                   | NUMERIC         |
| inline\_post\_engagement               | NUMERIC         |
| objective                              | STRING          |
| reach                                  | NUMERIC         |
| social\_spend                          | NUMERIC         |
| spend                                  | NUMERIC         |
| unique\_clicks                         | NUMERIC         |
| unique\_ctr                            | NUMERIC         |
| unique\_inline\_link\_click\_ctr       | NUMERIC         |
| unique\_inline\_link\_clicks           | NUMERIC         |
| website\_ctr                           | RECORD          |
