This repository is designed to streamline the retrieval and processing of targeting data from Meta’s advertising platform. The hope is that this tool is useful for researchers, analysts, and organizations seeking to understand ad targeting strategies across different countries and timeframes.
💡 Support Open-Source Development
If metatargetr
has been helpful to you, consider supporting the
project! Every contribution
keeps the maintenance work going and helps me develop new features 😊
Meta’s advertising platform only provides data for limited, predefined timeframes: the last 7, 30, and 90 days. Consequently, historical data is inaccessible once it surpasses these time windows. This repository addresses this limitation by archiving and structuring historical data, enabling researchers and analysts to access datasets that would otherwise be unavailable.
This repository provides a framework to: - Access and process historical data on political or commercial ad targeting. - Retrieve targeting data by country, timeframe, and targeting criteria. - Automate workflows for downloading and storing target audiences for the predefined periods (7, 30, or 90 days) and preserving this data for long-term analysis.
It integrates with the
metatargetr
package to
fetch audience targeting data directly from Meta’s GitHub releases.
-
Automated Data Retrieval:
get_targeting_db
frommetatargetr
package enables easy access to targeting datasets stored as.parquet
files on GitHub. -
Support for Multiple Countries: Retrieve data across a wide range of countries using their ISO codes.
-
Custom Timeframes: Specify timeframes (e.g.,
LAST_30_DAYS
) to tailor the analysis to specific periods. -
Data Cleaning and Integration: Seamlessly combines data from different sources, such as Meta’s reports and the PartyFacts database, into one unified dataset.
A typical workflow might involve:
-
Specifying a country (e.g., “DE” for Germany) and timeframe (e.g., last 30 days) as well as from which date it should count (ds = “2024-10-25”).
-
Using the
get_targeting_db
function to fetch the latest targeting data:latest_data <- get_targeting_db(the_cntry = "DE", tf = 30, ds = "2024-10-25")
If you use the metatargetr
package or data from its database in your
research, publications, or other outputs, please ensure you provide
proper attribution. This helps recognize the effort and resources
required to maintain and provide access to these data.
Votta, Fabio, & Mendoza, Philipp. (2024).
metatargetr
: A package for parsing and analyzing ad library and targeting data. GitHub. Available at: https://github.com/favstats/metatargetr
@misc{votta2024metatargetr,
author = {Votta, Fabio and Mendoza, Philipp},
title = {metatargetr: A package for parsing and analyzing ad library and targeting data},
year = {2024},
publisher = {GitHub},
url = {https://github.com/favstats/metatargetr}
}
If you use data from the metatargetr
database, please include the
following acknowledgement in your work:
Data were retrieved from the
metatargetr
database, maintained by Fabio Votta. The database archives targeting data from the Meta Ad Library and Google Transparency Report. For more information, visit https://github.com/favstats/metatargetr.
By including these citations and acknowledgements, you help support the
continued development of metatargetr
and its associated resources.
Thank you for your collaboration!