compareTwoPeriods
Compare performance metrics for an account, campaign, ad set, or ad across two chosen periods. Pick preset or custom dates and view spend, results, clicks, and more to pinpoint changes.
Instructions
Compare performance metrics between two explicit periods for an account, campaign, adset, or ad. Each side accepts either a preset or a custom timeRange. Result selection can follow the primary action inferred from insights, a specific Meta action_type, or all actions. Optional metrics let callers compare spend, results, cpr, impressions, clicks, and/or ctr; omitting metrics keeps the backward-compatible spend/results/cpr default. For campaigns, the response also explains whether the baseline came from the same campaign, a similar campaign, or the account campaign average.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| level | Yes | Aggregation level for the comparison | |
| metrics | No | ||
| objectId | Yes | ID of account (act_XXX), campaign, adset, or ad. Account name is also supported. | |
| resultMode | No | How to define results for the comparison. Default: primary_from_insights. | primary_from_insights |
| currentPeriod | Yes | Current period selector. Pass either { datePreset } or { timeRange: { since, until } }. Legacy preset strings are still accepted and normalized. | |
| previousPeriod | Yes | Previous period selector. Pass either { datePreset } or { timeRange: { since, until } }. Legacy preset strings are still accepted and normalized. | |
| resultActionType | No | Specific Meta action_type to compare (for example: lead or purchase). If provided without resultMode, specific_action is inferred. |