Snapchat Ads
Snapchat Ads is an advertising platform that enables businesses to create, manage, and analyze ad campaigns targeting Snapchat's user base.
Bruin supports Snapchat Ads as a source for Ingestr assets, and you can use it to ingest data from Snapchat Ads into your data warehouse.
In order to set up Snapchat Ads connection, you need to add a configuration item in the .bruin.yml file and asset file. You need refresh_token, client_id, client_secret, and optionally organization_id. For details on how to obtain these credentials, please refer here
Follow the steps below to correctly set up Snapchat Ads as a data source and run ingestion.
Step 1: Add a connection to .bruin.yml file
To connect to Snapchat Ads as a source, you need to add a configuration item to the connections section of the .bruin.yml file. This configuration must comply with the following schema:
connections:
<destination_connection_details>
snapchatads:
- name: my-snapchatads
refresh_token: "your_refresh_token"
client_id: "your_client_id"
client_secret: "your_client_secret"
organization_id: "your_organization_id"refresh_token(required): OAuth refresh token for Snapchat Ads API authentication.client_id(required): OAuth client ID for your Snapchat Ads API app.client_secret(required): OAuth client secret for your Snapchat Ads API app.organization_id(optional): Organization ID. Required for most resources exceptorganizations.
Step 2: Create an asset file for data ingestion
To ingest data from Snapchat Ads, you need to create an asset configuration file. This file defines the data flow from the source to the destination. Create a YAML file (e.g., snapchat_ads_ingestion.yml) inside the assets folder and add the following content:
name: public.snapchatads
type: ingestr
connection: postgres
parameters:
source_connection: my-snapchatads
source_table: 'campaigns'
destination: postgresname: The name of the asset.type: Specifies the type of the asset. Set this to ingestr to use the ingestr data pipeline.connection: This is the destination connection, which defines where the data should be stored. For example:postgresindicates that the ingested data will be stored in a Postgres database.source_connection: The name of the Snapchat Ads connection defined in .bruin.yml.source_table: The table in Snapchat Ads you want to ingest.
Available Source Tables
Organization-level Resources
These resources require only authentication credentials:
| Table | PK | Inc Key | Inc Strategy | Details |
|---|---|---|---|---|
organizations | id | updated_at | merge | Retrieves all organizations for the authenticated user |
fundingsources | id | updated_at | merge | Retrieves all funding sources for the organization (requires organization_id) |
billingcenters | id | updated_at | merge | Retrieves all billing centers for the organization (requires organization_id) |
adaccounts | id | updated_at | merge | Retrieves all ad accounts for the organization (requires organization_id) |
transactions | - | - | replace | Retrieves all transactions for the organization (requires organization_id) |
members | - | - | replace | Retrieves all members of the organization (requires organization_id) |
roles | - | - | replace | Retrieves all roles for the organization (requires organization_id) |
Ad Account-level Resources
These resources can fetch data for a specific ad account or all ad accounts in the organization. All of these resources support the table:ad_account_id format to fetch data for a specific ad account.
| Table | PK | Inc Key | Inc Strategy | Details |
|---|---|---|---|---|
campaigns | id | updated_at | merge | Retrieves all campaigns for ad account(s). Supports campaigns:ad_account_id |
adsquads | id | updated_at | merge | Retrieves all ad squads for ad account(s). Supports adsquads:ad_account_id |
ads | id | updated_at | merge | Retrieves all ads for ad account(s). Supports ads:ad_account_id |
invoices | id | updated_at | merge | Retrieves all invoices for ad account(s). Supports invoices:ad_account_id |
event_details | id | updated_at | merge | Retrieves all event details (pixel events) for ad account(s). Supports event_details:ad_account_id |
creatives | id | updated_at | merge | Retrieves all creatives for ad account(s). Supports creatives:ad_account_id |
segments | id | updated_at | merge | Retrieves all audience segments for ad account(s). Supports segments:ad_account_id |
Step 3: Run asset to ingest data
bruin run assets/snapchat_ads_ingestion.ymlAs a result of this command, Bruin will ingest data from the given Snapchat Ads table into your Postgres database.