Skip to content

Commit e4dcffc

Browse files
committed
fix(ahrefs): revert incorrect broken_backlinks column, fix missed top_pages conversion, revert unverified competitor value conversions
Independent re-verification against live Ahrefs v3 docs surfaced two real regressions from the earlier fix rounds and one missed conversion: - broken_backlinks: the earlier fix changed the selected column from http_code_target to http_code, but the docs say http_code is the *referring page's* status and http_code_target is the *broken target page's* status - the tool needs the latter (matches its own output description). Reverted to http_code_target. - top_pages: value field was never divided by 100 despite the docs stating it's in USD cents and the output already claiming USD - fixed. - rank_tracker_competitors_stats.trafficValue and the nested competitor.value in rank_tracker_competitors_overview were converted from cents to USD last round on a "match every other monetary field" assumption, but the live docs do not document these two fields as cents (unlike every field that was correctly converted). Reverted to passthrough and dropped the "(USD)" claim from their descriptions until Ahrefs documents the unit. Also added the missing "exact" mode option to top_pages' mode param description, matching every sibling tool.
1 parent 3c3d8bf commit e4dcffc

5 files changed

Lines changed: 11 additions & 11 deletions

File tree

apps/docs/content/docs/en/integrations/ahrefs.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ Get the top pages of a target domain sorted by organic traffic. Returns page URL
244244
| --------- | ---- | -------- | ----------- |
245245
| `target` | string | Yes | The target domain to analyze. Example: "example.com" |
246246
| `country` | string | No | Country code for traffic data. Example: "us", "gb", "de" \(default: "us"\) |
247-
| `mode` | string | No | Analysis mode: domain \(entire domain\), prefix \(URL prefix\), subdomains \(include all subdomains, default\). Example: "domain" |
247+
| `mode` | string | No | Analysis mode: domain \(entire domain\), prefix \(URL prefix\), subdomains \(include all subdomains, default\), exact \(exact URL match\). Example: "domain" |
248248
| `date` | string | No | Date to report metrics on, in YYYY-MM-DD format \(defaults to today\) |
249249
| `limit` | number | No | Maximum number of results to return. Example: 50 \(default: 1000\) |
250250
| `apiKey` | string | Yes | Ahrefs API Key |
@@ -633,7 +633,7 @@ Get competitor rankings for the keywords tracked in an Ahrefs Rank Tracker proje
633633
|`position` | number | Current ranking position |
634634
|`bestPositionKind` | string | Type of the best position achieved |
635635
|`traffic` | number | Estimated traffic to the competitor |
636-
|`value` | number | Estimated traffic value \(USD\) |
636+
|`value` | number | Estimated traffic value |
637637

638638
### `ahrefs_rank_tracker_competitors_stats`
639639

@@ -656,7 +656,7 @@ Get aggregate competitor stats for an Ahrefs Rank Tracker project: each competit
656656
| `competitorsStats` | array | Aggregate stats for each tracked competitor |
657657
|`competitor` | string | The competitor's URL |
658658
|`traffic` | number | Estimated monthly organic visits |
659-
|`trafficValue` | number | Estimated monthly organic traffic value \(USD\) |
659+
|`trafficValue` | number | Estimated monthly organic traffic value |
660660
|`averagePosition` | number | Average top organic position across tracked keywords |
661661
|`pos1To3` | number | Keywords ranking in top 3 positions |
662662
|`pos4To10` | number | Keywords ranking in positions 4-10 |

apps/sim/tools/ahrefs/broken_backlinks.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type {
44
} from '@/tools/ahrefs/types'
55
import type { ToolConfig } from '@/tools/types'
66

7-
const SELECT_FIELDS = 'url_from,url_to,http_code,anchor,domain_rating_source'
7+
const SELECT_FIELDS = 'url_from,url_to,http_code_target,anchor,domain_rating_source'
88

99
export const brokenBacklinksTool: ToolConfig<
1010
AhrefsBrokenBacklinksParams,
@@ -71,7 +71,7 @@ export const brokenBacklinksTool: ToolConfig<
7171
const brokenBacklinks = (data.backlinks || []).map((link: any) => ({
7272
urlFrom: link.url_from || '',
7373
urlTo: link.url_to || '',
74-
httpCode: link.http_code ?? null,
74+
httpCode: link.http_code_target ?? null,
7575
anchor: link.anchor || '',
7676
domainRatingSource: link.domain_rating_source ?? 0,
7777
}))

apps/sim/tools/ahrefs/rank_tracker_competitors_overview.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export const rankTrackerCompetitorsOverviewTool: ToolConfig<
9999
position: competitor.position ?? null,
100100
bestPositionKind: competitor.best_position_kind ?? null,
101101
traffic: competitor.traffic ?? null,
102-
value: typeof competitor.value === 'number' ? competitor.value / 100 : null,
102+
value: competitor.value ?? null,
103103
})),
104104
}))
105105

@@ -154,7 +154,7 @@ export const rankTrackerCompetitorsOverviewTool: ToolConfig<
154154
},
155155
value: {
156156
type: 'number',
157-
description: 'Estimated traffic value (USD)',
157+
description: 'Estimated traffic value',
158158
optional: true,
159159
},
160160
},

apps/sim/tools/ahrefs/rank_tracker_competitors_stats.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export const rankTrackerCompetitorsStatsTool: ToolConfig<
7979
const competitorsStats = (data['competitors-metrics'] || []).map((item: any) => ({
8080
competitor: item.competitor || '',
8181
traffic: item.traffic ?? null,
82-
trafficValue: typeof item.traffic_value === 'number' ? item.traffic_value / 100 : null,
82+
trafficValue: item.traffic_value ?? null,
8383
averagePosition: item.average_position ?? null,
8484
pos1To3: item.pos_1_3 ?? 0,
8585
pos4To10: item.pos_4_10 ?? 0,
@@ -110,7 +110,7 @@ export const rankTrackerCompetitorsStatsTool: ToolConfig<
110110
},
111111
trafficValue: {
112112
type: 'number',
113-
description: 'Estimated monthly organic traffic value (USD)',
113+
description: 'Estimated monthly organic traffic value',
114114
optional: true,
115115
},
116116
averagePosition: {

apps/sim/tools/ahrefs/top_pages.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const topPagesTool: ToolConfig<AhrefsTopPagesParams, AhrefsTopPagesRespon
2828
required: false,
2929
visibility: 'user-or-llm',
3030
description:
31-
'Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default). Example: "domain"',
31+
'Analysis mode: domain (entire domain), prefix (URL prefix), subdomains (include all subdomains, default), exact (exact URL match). Example: "domain"',
3232
},
3333
date: {
3434
type: 'string',
@@ -82,7 +82,7 @@ export const topPagesTool: ToolConfig<AhrefsTopPagesParams, AhrefsTopPagesRespon
8282
traffic: page.sum_traffic ?? 0,
8383
keywords: page.keywords ?? null,
8484
topKeyword: page.top_keyword ?? null,
85-
value: page.value ?? null,
85+
value: typeof page.value === 'number' ? page.value / 100 : null,
8686
}))
8787

8888
return {

0 commit comments

Comments
 (0)