This will build a list that can be passed to adlib_get. Visit https://developers.facebook.com/docs/marketing-api/reference/ads_archive/ for full API documentation.
Usage
adlib_build_query(
ad_active_status = c("ALL", "ACTIVE", "INACTIVE"),
ad_delivery_date_max = NULL,
ad_delivery_date_min = NULL,
ad_reached_countries,
ad_type = c("POLITICAL_AND_ISSUE_ADS", "CREDIT_ADS", "EMPLOYMENT_ADS", "HOUSING_ADS",
"ALL"),
bylines = NULL,
delivery_by_region = NULL,
estimated_audience_size_max = NULL,
estimated_audience_size_min = NULL,
languages = NULL,
media_type = NULL,
publisher_platforms = NULL,
search_page_ids = NULL,
search_terms = NULL,
search_type = c("KEYWORD_UNORDERED", "KEYWORD_EXACT_PHRASE"),
unmask_removed_content = FALSE,
limit = 1000,
fields = DEFAULT_FIELDS
)
Arguments
- ad_active_status
Status of the ads. One of 'ACTIVE', 'INACTIVE', or 'ALL'
- ad_delivery_date_max
character. Search for ads delivered before the date (inclusive) you provide. The date format should be YYYY-mm-dd.
- ad_delivery_date_min
character. Search for ads delivered after the date (inclusive) you provide. The date format should be YYYY-mm-dd.
- ad_reached_countries
Vector of ISO country codes. Facebook delivered the ads in these countries.
- ad_type
The type of ad. One of 'ALL', 'POLITICAL_AND_ISSUE_ADS', 'HOUSING_ADS', 'NEWS_ADS', or 'UNCATEGORIZED_ADS'. Currently only 'POLITICAL_AND_ISSUE_ADS' is supported.
- bylines
Filter results for ads with a paid for by disclaimer byline, such as political ads that reference “immigration” paid for by “ACLU”.
- delivery_by_region
Character vector of region names. View ads by the region (such as state or province) where people live or were located when they saw them.
- estimated_audience_size_max
Search for ads with a maximum estimated audience size. Must be one of these range boundaries: 1000, 5000, 10000, 50000, 100000, 500000, 1000000, or leave empty for no maximum boundary.
- estimated_audience_size_min
Search for ads with a minimum estimated audience size. Must be one of these range boundaries: 100, 1000, 5000, 10000, 50000, 100000, 500000, 1000000.
- languages
a character vector of languages that the ad appears in
- media_type
Search for ads based on whether they contain a specific type of media such as an image or video.
- publisher_platforms
The platforms on which the ads appeared. One or more of "FACEBOOK", "INSTAGRAM", "AUDIENCE_NETWORK", "MESSENGER", "WHATSAPP".
- search_page_ids
A vector of up to 10 page IDs to search.
- search_terms
A search string.
- search_type
The type of search to use for search_terms field. KEYWORD_EXACT_PHRASE will return results that contain an exact match for the search term. Multiple search terms separated by commas can be used to retrieve results that contain an exact match for each phrase. KEYWORD_UNORDERED will return results that contain the word in the search term in any order. By default this is set to KEYWORD_UNORDERED.
- unmask_removed_content
Specify whether you would like your results to reveal content that was removed for violating our standards.
- limit
The maximum number of results to return
- fields
the fields to include in the response.
Details
Visit the online API documentation for the most up to date list of available fields. Call adlib_supported_fields() to see a list of the fields supported by this package. This should usually be in sync with the official API fields list but you can pass fields not in this list to the request if they fall out of sync, which will throw a warning and may not parse nicely into a table.