Facebook Ads: Query Builder
In this article, we will create a custom query using the Facebook Ads Query Builder in order to highlight the features and functionality of the tool. For this example, we will be creating a new metric that will give us the reach value sorted by region from a selected campaign.
IN THIS ARTICLE
1. Basic Options
We chose "Reach by Region / Likes Campaign" for our query name.
dimensionsparameter breaks down metrics by common criteria ('Breakdowns' in Facebook Ads), such as by
region(like in our example). When dimensions are requested, values are segmented by the dimension value. If a query has no
dimensionsparameter, the returned metrics will provide aggregate values for the requested date range, such as overall reach.
Same period last year.
2. Advanced Options
In our example, we set filters in order to retrieve data only for certain regions (specified by the 'dimension') from a campaign named "Likes" in the US with more than 500 impressions.
ANDboolean logic. Filtered queries restrict the rows that do (or do not) get included in the result. Each row in the result is tested against the filter. If the filter matches, the row is retained. If it doesn't match, the row is dropped.
- Contains: Aggregate metrics where the country contains
- Does not contain: Aggregate metrics where the country does not contain
- Equals: Return results for regions where number of impressions is exactly
- Does not equal: Return results for regions where number of impressions is not
- Greater than: Return results for regions where number of impressions is strictly greater than
- Less than: Return results for regions where number of impressions is strictly less than
- Greater than or equal to: Return results for regions where number of impressions is
- Less than or equal to: Return results for regions where number of impressions is
When everything mentioned above is set, click "Run query" to show Data preview.
3. Data preview
In Data Preview you will see all values for selected metrics and date ranges. At the bottom you can check total values. Just click on tabs to switch between date ranges.
If you want to sort values by date/time just click on the arrow next to "Date"
When your query is ready, click "Save query." This creates a metric in Databox, with the metric name the same as the custom query name (Reach by Region / Likes Campaign).
By default, a metric will be added within the data source that the data is pulled from. It is possible to change the target data source by clicking on "Change target data source" in the top right of the screen.
It is possible to rename dimensions. Best practice is to rename them before saving the query. You can do this by clicking "..." next to "Dimension" and then selecting "Rename dimension"
This function is useful when you want to exclude one or more dimensions. For example, this would be useful if you want to show data for all regions except one. Click "..." next to "Dimension" and select "Skip dimension"
Click "..." next to "Value" and select "Round values." Enter the number of decimal places to be rounded to into field in popup, and values will be rounded accordingly.