Databricks

How to connect TikTok Ads to Databricks, step by step

To connect TikTok Ads to Databricks, create a connector Data Mart on a Databricks storage, sign in with TikTok, enter the advertiser IDs, choose the data level and the Ad Performance endpoint, and name the catalog, schema and table. The data level sets the grain of the table and should not be changed after the first load. The connector then refreshes the table on a schedule.

DatabricksIevgen Krasovytskyi8 min read

How to connect TikTok Ads to Databricks, step by step

TikTok campaigns go live in a week. TikTok reporting usually takes much longer to arrive, and when it does it is a monthly export pasted next to the other channels.

This guide replaces the export with a table: TikTok Ads data in Databricks, loaded by the TikTok Ads connector in OWOX Data Marts and refreshed on a schedule. It follows the five setup screens, flags the one setting that cannot be changed afterwards, and ends with SQL validated against a table the connector loaded.

What you end up with

What you end up with

A Delta table in your own Databricks workspace, tiktok_ads_ad_insights, with one row per ad per day by default: impressions, clicks, spend, conversions, video views and engagement.

The connector reads the TikTok Marketing API, writes that table and repeats on a schedule. It does not model the data. What you build on top, in SQL or a notebook, is yours.

Before you start

Before you start

In TikTok

A TikTok for Business user assigned to the advertiser account, and the numeric advertiser ID from TikTok Ads Manager.

In Databricks

A storage of type Databricks connected to your OWOX Data Marts project. The storage guide asks for the workspace host, the HTTP path of a SQL warehouse and a personal access token. The token’s user needs permission to create schemas and tables in the catalog you choose, and to run queries on that warehouse.

The SQL warehouse behind the HTTP path does the work, so it sets the cost. Turn on auto stop and start small. Databricks pricing shows what a short daily job is billed for.

The Turning Point

OWOX Data Marts

See your first report built in real time. 15 minutes.

  1. Connect your data warehouse
  2. Pick your metrics
  3. Get a live Google Sheets report

In the time it takes to write a ticket. Then imagine never writing that ticket again.

Book a Demo

We'll use your actual use case

Step 1: create the Data Mart and choose the connector

Step 1: create the Data Mart and choose the connector

Click New Data Mart, give it a title, pick the Databricks storage and click Create Data Mart. On the Data Setup tab, set Definition Type to Connector.

Set Up Connector dialog in OWOX Data Marts, step 1 of 5, with TikTok Ads selected in a list that also shows Facebook Ads, Google Ads, LinkedIn Ads, Microsoft Ads, Reddit Ads, Shopify and X Ads – every source is set up through the same five screens

Choose TikTok Ads and click Next.

Step 2: sign in, enter the advertisers and choose the data level

Step 2: sign in, enter the advertisers and choose the data level

Continue with TikTok is the short way. Sign in as a user who can access the advertiser account and approve access. It needs no developer app.

Manually means your own TikTok developer app: an access token, an App ID and an App Secret. TikTok reviews every app, which can take up to seven business days. The credentials guide covers it.

Edit Connector form for TikTok Ads in OWOX Data Marts on a Databricks Data Mart, with a Continue with TikTok button, a Manually link, a required Advertiser IDs field and a Data Level selector set to AUCTION_AD – the grain is chosen in the same form as the sign-in

Fill in Advertiser IDs with the numbers only. Several advertisers go in one field, separated by commas or semicolons, and they all write into the same table.

The data level

Data Level decides what one row of the performance table means. Get it right the first time.

  • AUCTION_AD, the default. One row per ad per day.
  • AUCTION_ADGROUP. One row per ad group per day.
  • AUCTION_CAMPAIGN. One row per campaign per day.
  • AUCTION_ADVERTISER. One row per advertiser per day.

The level also decides the keys the connector merges rows on, which is why you should not change it after data has been loaded. New rows would be matched on a different set of keys than the rows already in the table. If you need a second grain, create a second Data Mart with its own table.

For most reporting, keep the default. Ad level can always be summed up to campaigns. The reverse is not possible.

Step 3: choose the endpoint

Step 3: choose the endpoint

Each Data Mart loads one endpoint.

Set Up Connector dialog in OWOX Data Marts, step 3 of 5, listing TikTok Ads endpoints with a description each: advertiser, campaigns, ad_groups, ads, ad_insights, ad_insights_by_country and audiences – performance and structure are separate endpoints

  • ad_insights. Daily performance at the data level you chose. The one for reporting.
  • ad_insights_by_country. The same, with a country breakdown.
  • campaigns, ad_groups and ads. Names, objectives, budgets, statuses and creative details.
  • advertiser and audiences. Account details and custom audiences.

Step 4: choose the fields

Step 4: choose the fields

The key fields for your data level are locked, and the panel says which ones.

Connector Fields panel for TikTok Ads in OWOX Data Marts on a Databricks Data Mart, with 24 of 39 fields selected for ad_insights, a note that required fields depend on the data level, and ad_id, advertiser_id and stat_time_day locked as keys – the keys follow from the grain chosen earlier

Beyond impressions, clicks and spend, take the fields that are specific to TikTok: video views, two-second and six-second views, completions, and likes, comments, shares and follows.

Step 5: name the catalog, schema and table

Step 5: name the catalog, schema and table

On Databricks the destination has three levels.

Set Up Connector dialog in OWOX Data Marts, step 5 of 5, with Catalog name set to main, Schema name tiktok_ads_owox and Table name tiktok_ads_ad_insights, each noted as created on first run if it does not exist – the destination is a three-level Unity Catalog name

The setup proposes the catalog main, a schema named after the source and a table named after the endpoint. Each is created on the first run if it does not exist. If you load several ad platforms, pointing them all at one schema keeps later queries shorter.

Click Save, then Publish & Run Data Mart. The first run loads data from the first day of the previous month and can take several minutes.

Data Setup tab of a published TikTok Ads connector Data Mart in OWOX Data Marts, showing the TikTokAds source with the ad_insights endpoint and the Databricks catalog, schema and table it writes to – the data is in your workspace

Load history and set the schedule

Load history and set the schedule

Backfill

Click Manual Run and choose Backfill (custom period). One backfill run covers at most 31 days. For a longer history, run consecutive periods, each after the previous one has finished.

Manual Run panel in OWOX Data Marts with Backfill (custom period) selected, start and end date fields and a note that a backfill run can cover at most 31 days – history is loaded one month at a time

Schedule

A Data Mart without a trigger does not run again. On the Triggers tab, add a trigger of type Connector Run: daily, weekly, monthly or at an interval.

Triggers tab of a TikTok Ads Data Mart on Databricks in OWOX Data Marts, with a connector run scheduled daily at 08:00 and a report run daily at 09:00, each showing its next and last run – the load and the report that depends on it are scheduled an hour apart

If a report reads from this Data Mart, schedule it after the connector run, as in the example above, so it picks up the fresh data.

Each scheduled run re-requests the days set by the Reimport Lookback Window, two by default. Impressions, clicks and spend settle within a day or two. Conversions keep arriving for as long as your attribution window, so if you report on them, set the lookback at least that long.

Run History shows every run with its time and status.

Run History tab of a TikTok Ads Data Mart on Databricks in OWOX Data Marts, listing scheduled connector runs on consecutive days, each with a Success status – the daily load is visible and auditable

One advanced setting to leave alone: Create Empty Tables. With it off, an account with no delivery yet gets no table, and later runs fail because the table is not found.

What the table looks like in Databricks

What the table looks like in Databricks

A three-level name, no quoting. With the proposed names the table is main.tiktok_ads_owox.tiktok_ads_ad_insights. Names are not case-sensitive.

The day is stat_time_day, a date column.

IDs, not names. The table carries campaign_id, adgroup_id and ad_id. Names are in the campaigns, ad_groups and ads endpoints. Load the ones you need as separate Data Marts and join on the ID.

Metrics are numbers. impressions, clicks, spend, the video counts and the engagement counts can be summed directly.

Keys and comments in the catalog. The connector declares the keys as the table’s primary key and writes each field’s description as a column comment, so the table documents itself in Catalog Explorer.

Query the data

Query the data

All three queries were validated on a Databricks SQL warehouse against tables loaded by the connector. The examples use a shared schema, ads_owox, for all ad platforms.

Spend, clicks and cost per click by campaign and day, for the last 30 days:

SELECT
  stat_time_day AS date,
  campaign_id,
  SUM(impressions) AS impressions,
  SUM(clicks) AS clicks,
  SUM(spend) AS spend,
  SUM(spend) / NULLIF(SUM(clicks), 0) AS cpc
FROM main.ads_owox.tiktok_ads_ad_insights
WHERE stat_time_day >= date_sub(current_date(), 30)
GROUP BY stat_time_day, campaign_id
ORDER BY date, spend DESC;

How far people watch, by campaign:

SELECT
  campaign_id,
  SUM(impressions) AS impressions,
  SUM(video_views) AS video_views,
  SUM(video_watched_6s) AS views_6s,
  SUM(video_completion) AS completions,
  SUM(video_watched_6s)
    / NULLIF(SUM(video_views), 0) AS rate_6s,
  SUM(video_completion)
    / NULLIF(SUM(video_views), 0) AS completion_rate,
  SUM(spend) AS spend
FROM main.ads_owox.tiktok_ads_ad_insights
WHERE stat_time_day >= date_sub(current_date(), 30)
GROUP BY campaign_id
ORDER BY spend DESC;

TikTok next to LinkedIn, one row per day and channel:

SELECT
  stat_time_day AS date,
  'tiktok' AS channel,
  SUM(impressions) AS impressions,
  SUM(clicks) AS clicks,
  SUM(spend) AS spend
FROM main.ads_owox.tiktok_ads_ad_insights
GROUP BY stat_time_day

UNION ALL

SELECT
  dateRangeStart AS date,
  'linkedin' AS channel,
  SUM(impressions) AS impressions,
  SUM(clicks) AS clicks,
  SUM(costInUsd) AS spend
FROM main.ads_owox.linkedin_ads_ad_analytics
GROUP BY dateRangeStart;

Compute cpc, ctr and cpm from sums. The columns with those names hold the ratio for one ad on one day and cannot be averaged across rows.

From table to report

From table to report

The third query is worth more as a published definition than as a snippet. Save it as a SQL Data Mart and everyone reads the same unified spend table.

SQL Data Mart in OWOX Data Marts on Databricks named Paid Social Spend (Daily), with the TikTok and LinkedIn union query in the editor and a “Valid SQL code” check – the cross-channel definition lives in one place

On a Data Mart’s Destinations tab you attach reports to Google Sheets, Data Studio, Slack or email, each with its own columns and schedule. Databricks to Google Sheets walks through the scheduled report and the self-service route for business users.

Where to go next

Where to go next

The same five screens load the other sources into the same workspace: Facebook Ads, Google Ads and LinkedIn Ads.

On Snowflake the steps are the same and the naming rules differ: see TikTok Ads to Snowflake. For the platform itself, start with what Databricks is and how it works.

Your New Normal

Turn your data into decisions.

Governed data marts give you the clean foundation ML needs to actually work.

  • No AI hallucinations
  • Analyst-governed definitions
  • Every number traces to SQL
Get started free

FAQ

Frequently Asked Questions

What is the data level, and can I change it later?

The data level sets what one row of the performance table means: one ad, ad group, campaign or advertiser per day. It also sets the keys rows are merged on, so it should not be changed after data has been loaded into a table. For another grain, create a second Data Mart with its own table.

When do I need to reconnect TikTok in the connector?

After signing in with TikTok, OWOX Data Marts stores the token and uses it for scheduled runs. Reconnect when the user revokes access, TikTok invalidates the grant, the required permissions change, or the authorised user loses access to the advertiser account. Run History shows the error when a run fails for one of these reasons.

What is the Reimport Lookback Window in the TikTok Ads connector?

It is the number of days before the last imported date that each run requests again, two by default. Impressions, clicks and spend settle within a day or two. Conversions keep arriving for as long as your attribution window, so if you report on conversions, set the lookback at least as long as that window.

What TikTok Ads data can I import into Databricks with OWOX?

The ad_insights endpoint gives daily performance at the data level you choose, and ad_insights_by_country adds a country breakdown. The campaigns, ad_groups and ads endpoints hold names, objectives, budgets and statuses. The advertiser and audiences endpoints hold account details and custom audiences. Each endpoint is loaded by its own Data Mart.

Do I need a TikTok developer app to connect TikTok Ads to Databricks?

No, not with the Continue with TikTok button: you sign in as a TikTok for Business user who can access the advertiser account and approve access. A developer app is only needed for the manual method, which takes an access token, an App ID and an App Secret. TikTok reviews every app, which can take up to seven business days.

Who wrote this

Ievgen Krasovytskyi

Ievgen Krasovytskyi · Head of Marketing

Ievgen Krasovytskyi is the Head of Marketing at OWOX, leading strategy across content, SEO, product marketing, and AI-powered automation. With deep expertise in analytics infrastructure, data warehouses, and marketing technology, he builds systems that connect marketing performance to business outcomes. Ievgen writes about SaaS growth, analytics workflows, and the future of AI in marketing operations.