Monitoring your Facebook Ad campaigns with Rows

Learn how to use Rows integrations by working through a specific use case—monitoring ad campaigns.

If you’re running an online marketing campaign, chances are, you’re pulling data from different tools and merging that data in a spreadsheet or another third-party tool.

You can take advantage of our integrations with Google, LinkedIn, and Facebook to automatically pull your campaign data into one Rows spreadsheet to create your own dashboard.

Let’s start with Facebook.

Try it Yourself

If you'd like to experiment with the examples in this article, open the accompanying tutorial spreadsheet on the Community Page and click Duplicate to add a copy to your workspace.

We’ll be using the examples from this spreadsheet to walk you through the setup.


Connect your Facebook Ads account

If you’ve already connected your Facebook account, you can skip this step and jump straight to selecting the right account. Otherwise, read on.

The easiest way to connect your Facebook ads account is from the integrations section. Before you start, make sure you have a Rows account and that you’re already logged in. Also make sure that you’re already logged into the Facebook account that you want to connect.

To connect your Facebook ads account, follow these steps:

  • Open the Rows Facebook Ads integration page and click Connect.
  • In the dialog that appears, select the relevant workspace and click Connect again.
    In the following screenshot, we’ve selected the workspace “marketing”.

    Connect Facebook Ads confirmation


This is because we’ve already copied the tutorial spreadsheet to the “marketing” workspace, and we want to make sure the spreadsheet can access our Facebook account.

  • In the Facebook/Meta confirmation screen that appears, confirm that you want to connect your Facebook account.

Now you can open your copy of the tutorial spreadsheet to confirm that everything works.

Facebook ad accounts cell

To double check that your account is connected, follow these steps:

  • Find the FB_configuration table on the Facebook page of the tutorial spreadsheet

  • Select cell B2, open the cell actions menu, and click Re-execute function.
    It uses the GET_ACCOUNTS_FACEBOOK_ADS() function to get all of the Facebook Ads accounts associated with your main Facebook account.

  • You should still see the “ad accounts” value show up in the cell.
    If you see the error “#ACCOUNT”, your account still isn’t connected. Double-check that you copied the tutorial spreadsheet to the same workspace that is connected to your Facebook account.

Selecting the correct Facebook account

Once you've connected your Facebook account, you’ll see your Facebook Ads accounts listed in the “FB_AccountList” table. If you’re like us, you might have more than one Facebook Ads account. For example, one for testing and one for production.

By default, the tutorial spreadsheet takes the account name from cell “A4” of the “FB_AccountList” table, but you can change it to the cell that contains the relevant account name.

How the account name gets selected

The account name is used to fetch the relevant campaign data in the next step, so make sure you’re referencing the correct one.

Pull some campaign data

The next step is to define your report period and see if it returns some data. If you select cell B5 in the FB_Configuration table, you’ll see that we’ve configured the following formula:

=GET_CAMPAIGN_INSIGHTS_FACEBOOK_ADS(B3,,,,B4)
  • B3 defines the account name
  • B4 defines the reporting period

    Campaign data formulat

  • It’s all wrapped in an IF(ISERROR) formula so that we only request data if a valid Facebook account is connected.

You might notice that the cell labeled “Report Date Range” actually contains a single date. We’ll explain why in a moment, but for now, let’s just check that we get some data back.

  • In the “Report Date Range” cell (B4), use the date picker to enter a date where you’d expect to get some campaign data.

    Rows will request the campaign data for that date and put it in the “Campaign Data” cell (B5).

  • Select B5, open the cell actions menu, and click View Data.

    Number of results

In the previous screenshot, we can see that we have results for one ad with 14 data points (clicks, impressions, and so on). If it says {0}, then it means that there’s no data for that day and you should select a different date.

Put the campaign data in table

Once you’ve confirmed that you have some data, let’s put it in a table so that we can see it properly. In the tutorial spreadsheet, we’ve already set up a table called “FB_DailyDataLog.

FB Data log table

If you want to learn now we did it, follow these steps:

  • First create another empty table called “FB_DailyDataLogTest”.
  • Go back to the FB_Configuration table, and select the “campaign insights” cell (B4)
  • Open the cell actions menu, and click “Create Data Table”.
  • Configure the options to match the following screenshot.

Data table options

Here’s what we changed from the default settings:

OptionChange
Table HeadersIn the , we clicked “Select All” then de-selected “Account name”, “Account id”, “Campaign id”, “Date end” — none of these data points are necessary for this use case.
Table behaviorWe changed it to “update matching data and add new” — we want to incrementally build a daily log of our campaign data (rather than replace all data each time the data is refreshed).
Unique keysWe selected “Campaign name” and “Date start”—this means that we want to add a new entry to our daily log whenever there is new data for a combination of a specific campaign name and date.
  • For example, if there’s data for the campaign “DE | Summer 2022 | Referral Drive | Test” on the 25.05.2022, we add a new row to our daily log.
  • If the row already exists, we just update the existing data without adding a new row.
Table destinationWe entered “FB_DailyDataLogTest!A1” —want to put the data in our new empty table starting with cell A1.

To see the table updating, go back up to the “FB_Configuration” table and try changing the “Report Date Range” to different days.

Every time you select a date that isn’t already in the daily log, you should see a new row being automatically added to the “FB_DailyDataLogTest” table (and the FB_DailyDataLog table that came with the tutorial spreadsheet).

Add automation to update the log each day

It’s time to explain why we only have a single day for our report range. It’s because we want to get a daily breakdown of the data but the function GET_CAMPAIGN_INSIGHTS_FACEBOOK_ADSdoesn’t let us get the data broken down by day. This is a limitation of the Facebook Ads API.

So how do we get around this? We can’t do anything about data from the past, but we can set up Rows to log the daily stats going forward. Here’s how to do it.

  • In the “Report Date Range” cell (FB_Configuration!B4)replace the fixed date with the formula TODAY()-1.

    This set the data range to always be the day before today — i.e. yesterday.

Now we want to refresh this formula every day so that we always add the next day to the data. We’ve already set this up for you in the “Update Schedule” cell (B6).

  • If you select that cell, you’ll see the following formula: =SCHEDULE(B4:B5,"every day 09:00")

This tells rows to execute cells B4 and B5 at 9am UTC every morning.

  • B4 triggers a refresh of the “Report Date Range” parameter relative to the current date (set it to the "new" yesterday: i.e. todays date minus one).
  • B5 triggers a refresh of the campaign data for the new date.
  • When data for a new date is detected, the “FB_DailyDataLog” will get a new row and will slowly grow as the days go on.

Aggregating the daily data

If you have several campaigns, the data log will get pretty detailed. You'll want to have an aggregated view of the data in another table. That’s what the table FB_Summary is for.

In other applications, you might use a pivot table for aggregation, but in Rows, the SUMIF function is your go-to tool for aggregating data (which you’ll see in a moment).

The table itself contains notes on how it works, but let’s go through it step by step.

  • First off, all the formulas are wrapped in ISERROR and AUTOFILL functions.
    • The ISERROR is there to make the table look tidy and return a blank cell if there was a problem aggregated the values
    • The AUTOFILL function ensures that all formulas are automatically copied to any new rows that appear in the table (for example, if new campaigns show up in the data)

Aside from the ISERROR and AUTOFILL functions, here’s what each formula does.

CELL (DATA)FORMULA / DESCRIPTION
B3 (campaign_name)

expand(unique('FB_DailyDataLog'!B2:B)

Extract a list of unique campaign names from the daily data log (they’re in column B). This is so we can have just one aggregate row per campaign.
D3 (impressions)

SUMIF('FB_DailyDataLog'!$B2:B,$B4,'FB_DailyDataLog'!H2:H)

Add up all impressions (column H) from the daily log where the campaign name (column B) matches “campaign_name” (column B of our summary table).
E3 (clicks)

SUMIF('FB_DailyDataLog'!$B2:B,$B4,'FB_DailyDataLog'!G2:G)

Add up all clicks(column G) from the daily log where the campaign name matches the one in the “campaign_name” column (B).
F3 (spend)

SUMIF('FB_DailyDataLog'!$B2:B,$B4,'FB_DailyDataLog'!I2:I)

Add up all spend amounts (column I) from the daily log where the campaign name matches the one in the “campaign_name” column (B).
G3 (CTR)

E4/D4

Calculates click-through rate by dividing clicks by impressions.
H3 (CPM)

F4/(D4/1000)

Calculates cost per thousand impressions by dividing spend by impressions (divided by 1,000)
I3 (CPC)

F4/E4

Calculates cost per click by dividing spend by click.

If you’d prefer to see the data aggregated by day rather than by campaign, the tutorial spreadsheet also contains a second table which uses similar formulas. Instead of comparing the campaign names, the SUMIF formula looks at the dates instead.

Adding charts and combining data from different sources

If you’re up for a further challenge, why not add some charts and connect more accounts to get a unified view of your campaigns?

Adding charts

Campaign data is easier to analyze when it comes in chart form. To give you a taste of what’s possible, we’ve included a simple chart in the tutorial spreadsheet called “FB_CPCvCPM”. It tracks average CPM and CPC over a small time range. The data itself comes from the “FB_DailyDataLog” table.

CPC vs CPM chart

However, in terms of what charts to add, the choice is yours. You can visualize the data according to your own preferences. For a full guide on how to work with charts, see the Charts Overview section.

Combining Facebook Data with LinkedIn data

In the tutorial spreadsheet, we’ve included a page for LinkedIn campaign data too. The process for setting it up is almost identical to the process for Facebook.

The only difference is that you don’t need to set up a schedule to update the data log each day. The LinkedIn integration supports daily breakdowns, so you can get the data broken down by day for your chosen date range.

LinkedIn configuration

We’ve also included a “Consolidated data” page so you can see a simple demonstration of how the Facebook and LinkedIn data can be combined into one report.

In the green section of the spreadsheet, we’ve added documentation hints so you can understand what’s going on in the different cells.

Consolidated summary table

If you’ve made it this far, congratulations! That was a lot to get through.

But once you’ve got that hang of it, you won't want to go back to the way things were— using inflexible and expensive tools or relying on other departments to get the data you need. You’ll be free to tailor your own custom dashboards and impress your teammates with your newfound spreadsheet powers. The sky’s the limit!

Further References

Watch a condensed version of this tutorial on YouTube:



Related documentation: