Facebook Pause Ads with CPC above X

This automation lets you set a CPC threshold and pause all ads that exceed that CPC. It’s a good example of what you can do with Kitchn to bulk update ads based on certain metrics.

JSON Recipe

Import the automation recipe(s) into your own account. Don’t know how? Learn here.

Facebook Pause Ads with CPC above X
{"name":"Facebook Pause Ads with CPC above X","description":"This automation lets you set a CPC threshold and pause all ads that exceed that CPC.","nodes":{"start_1":{"type":"start","logging_enabled":false,"x":104,"y":306},"stop_1":{"type":"stop","logging_enabled":false,"x":1307,"y":362},"fb_fetch_insights_v6_1":{"type":"fb_fetch_insights_v6","logging_enabled":false,"x":370,"y":130,"group":"group_1","inputs":{"fields":{"export_enabled":true,"data":["spend","impressions","ad_id","actions"]},"level":{"export_enabled":true,"data":"ad"},"date_range":{"export_enabled":true,"data":"last_year"},"action_report_time":{"export_enabled":true,"data":"conversion"},"breakdowns":{"export_enabled":true},"action_breakdowns":{"export_enabled":true},"use_unified_attribution_setting":{"export_enabled":true,"data":true},"action_attribution_windows":{"export_enabled":true,"data":["default"]},"time_increment":{"export_enabled":true,"data":"all_days"}}},"calculate_metrics_1":{"type":"calculate_metrics","logging_enabled":false,"x":1034,"y":219,"group":"group_2","inputs":{"merge":{"export_enabled":true,"data":true}}},"input_any_1":{"type":"input_any","title":"Calculations Template","description":"Allows to input a any type","logging_enabled":false,"x":798,"y":96,"group":"group_2","inputs":{"any":{"title":"calculations","description":"The any to input","export_enabled":true,"data":[{"name":"ctr_link","operator":"/","pointer_a":"/actions_link_click","pointer_b":"/impressions"},{"name":"cpc","operator":"/","pointer_a":"/spend","pointer_b":"/actions_link_click"}]}},"outputs":{"any":{"title":"calculations","description":"The any to input"}}},"fb_select_ad_account_ids_v2_1":{"type":"fb_select_ad_account_ids_v2","logging_enabled":false,"x":73,"y":133,"group":"group_1","inputs":{"ad_account_ids":{"export_enabled":true,"data":[{"id":"1135934886600327","context":{"business":{"id":"999246123544891","name":"kitchn.io"},"ui":{"id":"act_1135934886600327","account_id":"1135934886600327","name":"Kitchn.io Demo Account","business":{"id":"999246123544891","name":"kitchn.io"}}},"provider":"facebook","type":"ad_account"}]}}},"filter_v2_1":{"type":"filter_v2","title":"Filter Based on CPC","description":"filters a items of any by atributes of it's schema","logging_enabled":false,"x":867,"y":58,"group":"group_3"},"input_number_1":{"type":"input_number","title":"CPC Filter Input","description":"Allows to input a number","logging_enabled":false,"x":548,"y":454,"group":"group_4","inputs":{"number":{"title":"cpc","description":"A number to input","export_enabled":true,"data":4}},"outputs":{"number":{"title":"cpc","description":"A number to input"}}},"patch_json_v2_1":{"type":"patch_json_v2","title":"Array from Filter","description":"Apply JSON patches against data","logging_enabled":false,"x":1097,"y":366,"group":"group_4","inputs":{"value":{"title":"filter","description":"A value that can be used in patches"},"patches":{"export_enabled":true,"data":[{"op":"add","path":"/-","value":"{{input.value}}"}]},"data":{"export_enabled":true,"data":[]}},"outputs":{"data":{"title":"filters","description":"The patched data"}}},"input_any_2":{"type":"input_any","title":"Filter Skeleton Data","description":"Allows to input a any type","logging_enabled":false,"x":554,"y":258,"group":"group_4","inputs":{"any":{"title":"filter_skeleton","description":"The any to input","export_enabled":true,"data":{"operator":"\u003e","pointer":"/cpc","value":0}}},"outputs":{"any":{"title":"filter_skeleton","description":"The any to input"}}},"patch_json_v2_2":{"type":"patch_json_v2","title":"Add Input to CPC Filter","description":"Apply JSON patches against data","logging_enabled":false,"x":833,"y":364,"group":"group_4","inputs":{"patches":{"export_enabled":true,"data":[{"op":"replace","path":"/value","value":"{{input.value}}"}]},"value":{"title":"cpc","description":"A value that can be used in patches"},"data":{"title":"filter_skeleton","description":"The data the patches are applied to"}},"outputs":{"data":{"title":"filter","description":"The patched data"}}},"for_each_v2_1":{"type":"for_each_v2","logging_enabled":false,"x":1150,"y":348,"group":"group_5"},"patch_json_v2_3":{"type":"patch_json_v2","title":"Patch PAUSED Status","description":"Apply JSON patches against data","logging_enabled":false,"x":1480,"y":370,"group":"group_6","inputs":{"data":{"title":"ad","description":"The data the patches are applied to","export_enabled":true,"data":{"id":"","status":"ACTIVE"}},"patches":{"export_enabled":true,"data":[{"op":"replace","path":"/status","value":"{{input.value}}"}]}},"outputs":{"data":{"title":"ad","description":"The patched data"}}},"build_filter_1":{"type":"build_filter","title":"Build Filter Active","description":"Builds a filter object to be used with a Filter node.","logging_enabled":false,"x":467,"y":348,"group":"group_7","inputs":{"filters":{"export_enabled":true,"data":[{"value":"ACTIVE","pointer":"/status","operator":"="}]},"schema":{"export_enabled":true,"data":"fb_ad"}}},"filter_v2_2":{"type":"filter_v2","logging_enabled":false,"x":814,"y":332,"group":"group_7"},"input_string_1":{"type":"input_string","title":"PAUSED Status","description":"Allows to input a string","logging_enabled":false,"x":1357,"y":109,"group":"group_6","inputs":{"string":{"title":"status","description":"A string to input","export_enabled":true,"data":"PAUSED"}},"outputs":{"string":{"title":"status","description":"A string to input"}}},"fb_update_ad_1":{"type":"fb_update_ad","title":"Update Facebook Ad","description":"Updates the provided attributes of an Ad.","logging_enabled":true,"x":1967,"y":350,"group":"group_5"},"patch_json_v2_4":{"type":"patch_json_v2","logging_enabled":false,"x":1744,"y":373,"group":"group_6","inputs":{"value":{"title":"ad_data","description":"A value that can be used in patches"},"data":{"title":"ad","description":"The data the patches are applied to"},"patches":{"title":"Patch Ad Id","description":"The patches to apply","export_enabled":true,"data":[{"op":"replace","path":"/id","value":"{{input.value/ad_id}}"}]}},"outputs":{"data":{"title":"ad","description":"The patched data"}}}},"edges":["fb_select_ad_account_ids_v2_1.ad_account_ids:fb_fetch_insights_v6_1.ad_account_ids","start_1.start:fb_fetch_insights_v6_1.fetch","fb_fetch_insights_v6_1.fetched:calculate_metrics_1.calculate","fb_fetch_insights_v6_1.insights:calculate_metrics_1.items","input_any_1.any:calculate_metrics_1.calculations","input_number_1.number:patch_json_v2_2.value","patch_json_v2_2.patched:patch_json_v2_1.patch","calculate_metrics_1.items:filter_v2_1.items","input_any_2.any:patch_json_v2_2.data","patch_json_v2_2.data:patch_json_v2_1.value","calculate_metrics_1.calculated:patch_json_v2_2.patch","patch_json_v2_1.patched:filter_v2_1.filter","patch_json_v2_1.data:filter_v2_1.filters","build_filter_1.filters:filter_v2_2.filters","fb_update_ad_1.updated:for_each_v2_1.next","for_each_v2_1.do:patch_json_v2_3.patch","for_each_v2_1.done:stop_1.stop","input_string_1.string:patch_json_v2_3.value","patch_json_v2_3.data:patch_json_v2_4.data","patch_json_v2_4.data:fb_update_ad_1.ad","for_each_v2_1.item:patch_json_v2_4.value","filter_v2_2.items:for_each_v2_1.items","patch_json_v2_4.patched:fb_update_ad_1.update","patch_json_v2_3.patched:patch_json_v2_4.patch","filter_v2_1.filtered:filter_v2_2.filter","filter_v2_1.items:filter_v2_2.items","filter_v2_2.filtered:for_each_v2_1.start"],"groups":{"group_4":{"title":"Build CPC Filters","description":"","x":558,"y":230,"group":"group_3","inputs":["patch_json_v2_2.patch"],"outputs":["patch_json_v2_1.patched","patch_json_v2_1.data"]},"group_1":{"title":"Get Ad Data","description":"","x":507,"y":135,"group":"group_2","inputs":["fb_fetch_insights_v6_1.fetch"],"outputs":["fb_fetch_insights_v6_1.insights","fb_fetch_insights_v6_1.fetched"]},"group_2":{"title":"Get Ad Ids \u0026 Calculations","description":"","x":254,"y":236,"inputs":["fb_fetch_insights_v6_1.fetch"],"outputs":["calculate_metrics_1.items","calculate_metrics_1.calculated"]},"group_3":{"title":"Filter Ads based on CPC","description":"","x":507,"y":231,"inputs":["filter_v2_1.items","patch_json_v2_2.patch"],"outputs":["filter_v2_1.items","filter_v2_1.filtered"]},"group_7":{"title":"Filter Ads based on Status","description":"","x":760,"y":232,"inputs":["filter_v2_2.items","filter_v2_2.filter"],"outputs":["filter_v2_2.items","filter_v2_2.filtered"]},"group_6":{"title":"Patch ID \u0026 Status","description":"","x":1455,"y":359,"group":"group_5","inputs":["patch_json_v2_3.patch","patch_json_v2_4.value"],"outputs":["patch_json_v2_4.data","patch_json_v2_4.patched"]},"group_5":{"title":"Update Each Ad","description":"","x":1033,"y":228,"inputs":["for_each_v2_1.items","for_each_v2_1.start"],"outputs":["for_each_v2_1.done"]}},"widgets":{"widget_1":{"title":"Facebook Ad Accounts","description":"Select one or more Facebook Accounts","position":0,"icon":"lab la-facebook","input":"fb_select_ad_account_ids_v2_1.ad_account_ids"},"widget_2":{"title":"CPC threshhold","description":"Pause all ads with a CPC above this","position":1,"icon":"las la-money-bill","input":"input_number_1.number"}},"config":{"capture_inputs_enabled":false,"caching_enabled":false},"tags":[]}

How To

Step 1

Copy the automation into your account.

Step 2

Select the Facebook Ad Account in which you would like to pause ads.

Set the CPC Threshold - this is the $ amount above which ads will be filtered

Notion image

Step 3

Click Run Automation and wait for the automation to pause all ads above the CPC threshold.

FAQ

Could I use this automation to pause ads based on different metrics (i.e. CTR)?

With a few small tweaks to this automation, yes. You can just change out the CPC filter for another metric filter.

Did this answer your question?
😞
😐
🤩

Last updated on July 25, 2023