top of page

Quick media Budget and Spend reporting


As the Senior Head of Performance at Laranjeira Agency, I oversee a team of Media Buyers and Performance Specialists. This team manages dozens of Meta and Google advertising accounts for various clients. As our team rapidly grows, new challenges in the management of the operation have started to appear.


Advertising platforms, such as Meta Ads and Google Ads, keep updating their interfaces and adding more security features. Because of this, I find it increasingly challenging to keep up with simple information, such as campaign spend and budget. Facing two-factor authentications, additional security checks, and then navigating the ever-changing sequence of screens just to find out how much will be spent at the end of the month is impractical.


Application for Reporting Budget and Spend Data


To help myself and the main stakeholders have faster and easier access to this data, I developed a simple application. This application is a web service hosted on Google Cloud that accesses our task/project management platform (Monday.com) and the advertising platforms APIs. All to deliver a small report to our internal communication app, Slack.


By accessing our Monday account, the application has information about all our clients' advertising accounts. With the IDs, the application accesses Meta and Google APIs, pulling all the data it needs. Then, this data is consolidated into an all-text report that is delivered to the corresponding Slack channel for the requested client.


The Report


In the following image, it's possible to see how the report looks. There is a small summary with the current consolidated daily budget and spend from Meta+Google, as well as a linear projection of the total spend for the current month given the actual budget. Below, there is detailed information about each account found on the provided Business Manager accounts and Google accounts.

Budget and Spend reporting in Slack, from Meta and Google APIs
Budget and Spend reporting in Slack, from Meta and Google APIs

By having this reporting feature "requestable and accessible" from the Slack app, we can avoid all the authentication and interface exploration. As a simple text payload, it is quick and easy to do a checkup on any account in our operation, even from a mobile device.


Requesting the report is as easy as entering the client's channel on Slack and typing the slash command "/xray". Depending on the amount of accounts and campaigns, it might take up to a minute, but usually, in a few seconds, we have our report.


Slack slash command for advertising reporting app
Slack slash command for advertising reporting app

Developing the web service(the technical stuff)


Getting into the technical details, this web service was developed in Python and deployed on Google Cloud. Since Slack requires a 3-second acknowledgment of successful processing of the request, Google Cloud's Pub/Sub was used to manage requests. The "publication" function receives the request, acknowledges it, and then publishes a "topic" on which the "xray" function is subscribed to.


The xray function then requests our client's data from Monday, which is used to request campaign data from Meta and Google. Since I wanted to have a breakdown of budget and spend by campaign, it was necessary to develop a class structure as seen in the following diagram.

Meta Ads API


Meta business accounts can have several advertising accounts that, in turn, can have as many campaigns, with ad sets and ads, as needed. Mostly, it's necessary to drill down all the way to ad set to have access to budget information. This also allows for full control on how, for instance, campaigns with a lifetime budget will be calculated into the total, since there isn't a predefined daily budget.


To get both spend and budget from Meta Ads API, it's necessary to access at least 3 endpoints. First, at Business Accounts level, to find out all ad accounts available. Then, for each ad account, our application taps into the Insights API, for the metrics of each campaign, including the spend. Budget is part of the ad set configuration, and that can only be obtained by requesting the data from Adset endpoint, for each campaign.


Google Ads API


Google's payload is much simpler to work with, a single request to Google Ads API will return all the data we need for each account, given a time frame. So a simple GoogleCampaign class was built to hold the broken-down data.


Building the report


Lastly, a MessageBuilder class was added to actually put together the message that is returned to Slack. Besides cost data, we can also see which campaigns are currently active and which accounts do not have any active campaigns.


Monday API


We store all the data about our clients' projects in Monday, where we manage tasks and track progress. So, having a "board" dedicated to store data needed for this application fits well with our onboarding processes. The application makes a request to the agency's Monday account, gathering data such as Meta and Google account IDs or the Slack channel it must return the report to.


Is it worth it, what about Adveronix?


There are "connectors," such as Adveronix, that are also able to provide the same data, without the need to code a single line. The great thing about this solution is that we are served the information directly in our main communication app (Slack), by typing only 5 characters in the correct channel.

Another great advantage over connectors is that all data is requested directly from Meta and Google, as soon as a few seconds after the command is sent in Slack. This gives us the most up-to-date information possible, in contrast with the hourly scheduled reports fed by connectors.


My final take


Once in a while, it's necessary to update a few packages and API versions, but generally, it's an application that requires low maintenance. Meta and Google APIs are well-documented and provide resources for building queries that accelerate development progress. A custom solution like this was definitely very useful for my management routine, and I would certainly recommend it for agencies that are scaling up.


bottom of page