Skip to main content
Skip table of contents

How-to Pause or Activate Meta (Facebook) Ads

Overview

In these instructions, we’ll focus on how to create the datasources and sql views to leverage the Alli Actions Ad Effective Status action to pause ads automatically. This can also be leveraged for the Adset Effective Status action to pause adsets, or the Campaign Effective Status action to pause campaigns.

You may set up an Alli Action to accomplish pausing or activating Meta ads, but the recommended path as of holiday 2024 is to onboard Alli Social Consolidation which can manage statuses for Meta, TikTok, Snapchat, and Pinterests simultaneously. To onboard to that solution, reference the onboarding documentation:Onboarding Alli Budget Consolidation

Instructions

Create your reference sheet datasource

  1. In your reference sheet, you need the following columns:

    1. ad_id (best) OR ad_name (good)

      1. Ensure ad_id is set to `plain text` and not number format

      2. We recommend including both or just ad_id, as ad_id is cleaner/simpler, and is required for activating ads

      3. If you select ad_id you can skip directly to creating your query

      4. If you select ad_name you will be using core data {client}_core.social_ad or {client}_core.social_adset or {client}_core.social_campaign in your SQL later on.

    2. date - the date you want the ad to be paused or activated

    3. status - the status you want implemented:

      1. Options are Active, Archived, Deleted, or Paused

USING YOUR GOOGLE SHEET TO POWER YOUR ACTION

The benefit of this method is no SQL and no report to manage. After you set this tab up fully, you will not touch it, nor should anyone else. - this is important

  1. Create a new tab, name it appropriately (Recommended Actions Sheet - DO NOT EDIT).

  2. Copy the headers from your first tab here.

    1. Rename your status column to effective_status

    2. Rename your ad_id (or campaign_id, adset_id, etc) column is named id

  3. In Cell A2, place and update this function =FILTER(Sheet1!A:D,Sheet1!B:B,Sheet1!B:B=TODAY())

    1. Sheet1 should be the name of your first sheet

  4. Check your google sheet timezone

    1. this is impactful because TODAY() gets the current date in the timezone. So if your action runs at 1 am eastern time on 2/10, but your google sheet is in pacific time, TODAY() in pacific time would be 2/9 (at 10 pm). TLDR - make sure your google sheet timezone makes sense with 1) what time & timezone your action will run in, and 2) what date you put in the first tab.

    2. File > Settings > Timezone

USING SQL TO POWER YOUR ACTION

  1. Login to Alli Data and select the client you want to create a datasource for

  2. Navigate to Reports, select Add New Datasource, and select the datasource type (Google Sheets, Smartsheet, Airtable, etc). Give your datasource a new name.

    1. In Advanced Settings, ensure you select Replace for New Uploads

    2. Ensure the Ad Id/Ad Name and the status columns are Numbers & Letters

    3. Ensure the Date column is a Date Timestamp

  3. Save your new datasource & select Load Data

Create your SQL view

  1. Set up your Alli Data Explorer Report, referring to the Getting started with Explorer Reports | Custom-SQL Custom SQL instructions

    1. Copy and paste the SQL Example in from below and update anything within and including { } to match your client settings

    2. Once your SQL is updated, click Publish to update the query

    3. Click Preview to ensure the output is as expected

Create your Action

  1. Go to Alli Actions then select Create Action.

  2. Filter the Vendor column for Facebook Ads and select the Update Status - Ad - Ad Level - Facebook Action Type

    image-20240917-191933.png

  3. Name your Action and select the Authenticated Account, the user account you'd like to use for making changes. The user associated with this account should have access to the relevant ad accounts.

    1. Start by giving your action a descriptive name that reflects the changes you plan to make.

    2. Tip: If your desired account isn't listed, or you need to create a new one, refer to the authentication documentation for instructions on how to authenticate a partner platform.

  4. Click Next. Select the correct data source where your changes are coming from. Since we have just created an Alli Data report to power this action, that will be Alli Data

  5. Choosing Alli Data will prompt you to click Select Source so you can filter to and select the datasource or report of your choosing

  6. Click Save and review your Action setup.

  7. Review Action for accuracy. Set up a schedule for your Action if applicable. Select the blue Publish button.

  8. A pop up box will confirm your setup. Click I’m Done to exit.

SQL Example: ID

  • replace {reference} with the datasource you created (ensure you remove the brackets as well)

    • ref.status should reference the column name of the status column in your reference datasource

    • ref.date should reference the column name of the date column in your reference datasource

Ad Example (assuming your column is named ad_id)

CODE
select ref.ad_id::text as id, 
      ref.status as effective_status 
from {reference} as ref
where ref.date = current_date

Adset Example (assuming your column is named adset_id)

CODE
select ref.adset_id::text as id, 
      ref.status as effective_status 
from {reference} as ref
where ref.date = current_date

Ad Example (assuming your column is named campaign_id)

CODE
select ref.campaign_id::text as id, 
      ref.status as effective_status 
from {reference} as ref
where ref.date = current_date

Filled out example (Pretending my datasource you created in Create your reference sheet datasource is named client.ad_status_google_sheet

CODE
select ref.ad_id::text as id, 
      ref.status as effective_status 
from client.ad_status_google_sheet as ref
where ref.date = current_date

SQL Example: Ad Name (Not recommended, use ad_id if possible)

  • replace {reference} with the datasource you created

    • ref.status should reference the column name of the status column in your reference datasource

    • ref.ad_name should reference the column name of the ad name column in your reference datasource

    • ref.date should reference the column name of the date column in your reference datasource

  • replace {client} with your client name

    • fb.ad_id should reference the column name of the ad id within the facebook datasource

    • fb.ad_name should reference the column name of the ad name within the facebook datasource

CODE
select distinct(fb.ad_id) as id, 
      ref.status as effective_status 
from {reference} as ref
left join {client}_core.social_ad as fb
on ref.ad_name = fb.ad_name
where ref.date = current_date

SQL Example: Creating separate queries for activating vs pausing

You can use the same reference sheet for both activating and pausing ads, and if so we recommend leveraging the ad_id column, as new ads (that have not run yet) may not exist in your facebook datasource yet (until they receive impressions or spend)

To use the same reference sheet, if your ads pause and activate at the same time, you don’t need separate sql, but if you activate and pause ads at different times (or just want to keep the queries separate) you can use the below options.

Pausing (using Ad Name)

CODE
select distinct(fb.ad_id)::text as id, 
      ref.status as effective_status 
from {reference} as ref
left join {facebook} as fb
on ref.ad_name = fb.ad_name
where ref.date = current_date
and status = 'Paused'

Pausing (Using Ad Id)

CODE
select ref.ad_id::text as id, 
      ref.status as effective_status 
from {reference} as ref
where ref.date = current_date
and status = 'Paused'

Activating

CODE
select ref.ad_id::text as id, 
      ref.status as effective_status 
from {reference} as ref
where ref.date = current_date
and status = 'Active'

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.