mirror of
https://github.com/simstudioai/sim.git
synced 2026-04-06 03:00:16 -04:00
fix(meta-ads): include onsite_conversion and app_custom_event subtypes in conversions
The conversion filter was only matching offsite_conversion.* subtypes but missing onsite_conversion.* and app_custom_event.* subtypes, which the Meta API commonly returns at the subtype level. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -132,10 +132,14 @@ export const metaAdsGetInsightsTool: ToolConfig<
|
||||
'onsite_conversion',
|
||||
'app_custom_event',
|
||||
])
|
||||
const conversionPrefixes = ['offsite_conversion.', 'onsite_conversion.', 'app_custom_event.']
|
||||
const conversions = actions
|
||||
.filter((a) => {
|
||||
const actionType = a.action_type as string
|
||||
return conversionTypes.has(actionType) || actionType?.startsWith('offsite_conversion.')
|
||||
return (
|
||||
conversionTypes.has(actionType) ||
|
||||
conversionPrefixes.some((prefix) => actionType?.startsWith(prefix))
|
||||
)
|
||||
})
|
||||
.reduce((sum, a) => sum + Number(a.value ?? 0), 0)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user