Linking Ahrefs as a source

Let AI connect your sources for you

Skip the manual setup — run this in your project and the wizard auto-detects your databases and APIs and connects them to PostHog.

Learn more
PostHog Wizard hedgehog

Contents

The Ahrefs connector syncs SEO data — Site Audit health scores, backlink profiles, organic keyword rankings, Domain Rating history, daily site metrics, and more — into the PostHog data warehouse, so you can analyze them alongside your product data.

Prerequisites

  • An Ahrefs Lite plan or higher.
  • An API key created in Account settings > API keys.
  • A Site Audit project ID. Find the numeric ID in the project URL: https://app.ahrefs.com/site-audit/123456.

Note: Page data (the site_audit_pages table) requires verified project ownership in Ahrefs.

Adding a data source

  1. In PostHog, go to the Sources tab of the data pipeline section.
  2. Click + New source and click Link next to this source.
  3. Enter your credentials (see Configuration below) and click Next.
  4. Select the tables you want to sync, choose a sync method and frequency, then click Import.

Once the syncs are complete, you can start querying this data in PostHog.

Import Site Audit crawl results, backlink data, organic keyword rankings, referring domains, Domain Rating history, daily site metrics, Rank Tracker rankings, and more from Ahrefs.

You'll be asked for:

  • API key — create one in Account settings > API keys.
  • Site Audit project ID — the numeric ID from your project URL (e.g. 123456 from https://app.ahrefs.com/site-audit/123456).

Sync modes

Each table can be synced in one of several modes, depending on what the source supports:

  • Webhook (when available) – the source pushes changes to PostHog in real time. Fastest freshness, lowest ongoing cost, and the only mode that reliably captures updates and deletes.
  • Incremental – only new or updated rows are synced on each run, using a cursor field (such as an updated_at timestamp). Cheaper than a full refresh, but deletes aren't captured.
  • Append only – new rows are appended using a cursor field; existing rows are never updated. Ideal for immutable, append-only tables like event logs.
  • Full refresh – the whole table is reloaded on every sync. Use it when a table has no reliable cursor or when you need deletions reflected.

See sync methods for a full explanation of how each mode works and how to choose between them.

Most Ahrefs tables are full refresh. The domain_rating_history, metrics_history, and site_metrics_daily tables sync incrementally on date.

API unit costs

Syncs use your Ahrefs account's API units. Plan for these costs per sync:

TableCost
Health scores, projects, Rank Tracker overviewFree
Top domains (1M rows)Free
Issues, pages50 units per request
Metrics history10 units per metric per month
Daily site metrics~150 units per day
Backlinks, keywords, referring domainsVaries by plan

The first sync of site_metrics_daily reads the last 7 days. Later syncs add each new day, up to 31 days back. History tables (domain_rating_history, metrics_history) start 180 days back on first sync.

Data limits

Some tables return a capped number of rows per sync:

TableLimit
site_audit_pages100 pages
backlinks1,000 live links
organic_keywords1,000 keywords
referring_domains1,000 domains
domain_rating_top_domains1,000,000 domains

Configuration

OptionDescription
API key
Type: password
Required: True
Site Audit project ID
Type: text
Required: True

Supported tables

TableDescriptionSync methodIncremental fieldPrimary key
site_audit_health_scores

Health score and crawl totals for the selected Site Audit project.

Full refresh——
site_audit_issues

Issue summaries from the latest crawl of the selected Site Audit project.

Full refresh——
site_audit_pages

The first 100 crawled URLs, ordered by URL. Requires verified project ownership.

Full refresh——
projects

Every project in the Ahrefs workspace, with its target URL, scope, and protocol.

Full refresh——
domain_rating_history

Monthly Domain Rating of the selected project's target.

Incremental, Full refreshdate—
metrics_history

Monthly organic and paid search traffic and traffic value of the selected project's target.

Incremental, Full refreshdate—
site_metrics_daily

Daily Domain Rating, Ahrefs Rank, live backlink and referring domain totals, and organic keyword and traffic totals of the selected project's target.

Incremental, Full refreshdate—
backlinks

Up to 1000 live backlinks to the selected project's target, strongest referring domains first.

Full refresh——
link_intersect_refdomains

Up to 1000 referring domains that link to the selected project's target or its competitors in Ahrefs, most shared first.

Full refresh——
link_intersect_refpages

Up to 1000 referring pages that link to the selected project's target or its competitors in Ahrefs, most shared first.

Full refresh——
brand_radar_web_pages

Up to 1000 web pages with the most traffic that mention the brands in each Brand Radar report linked to the selected project.

Full refresh——
domain_rating_top_domains

The top 1 million domains ranked by Ahrefs Domain Rating. Free to sync.

Full refresh——
organic_keywords

Up to 1000 keywords the selected project's target ranks for in organic search, highest traffic first.

Full refresh——
referring_domains

Up to 1000 domains with live links to the selected project's target, highest Domain Rating first.

Full refresh——
rank_tracker_overview

Current desktop and mobile rankings of the keywords tracked in the project's Rank Tracker.

Full refresh——

Troubleshooting

  • If the connection fails with an authentication error, the API key is wrong, expired, or has been revoked. Create a new one in Account settings > API keys, then reconnect the source.
  • If a sync fails with a quota error, your API units are exhausted. The sync retries automatically once units renew or you raise your limit.
  • If page data returns no rows, check that the Site Audit project has verified ownership.
  • If the sync fails with "no target for the Site Audit project", check that the project ID is correct and the project has a target URL configured.

If your sync is failing or data looks wrong, see the Data warehouse troubleshooting guide. If that doesn't help, contact support – we're happy to help.

Still have questions?

Was this page useful?