Code Monkey home page Code Monkey logo

metatargetr's Introduction

metatargetr

Lifecycle: experimental CRAN status

The goal of metatargetr is to parse targeting information from the Meta Ad Targeting dataset as well as retrieve data from the Audience tab in the Meta Ad Library.

Installation

You can install the development version of metatargetr like so:

remotes::install_github("favstats/metatargetr")

Load in Package

library(metatargetr)

Get Targeting criteria (Last 30 Days)

The following code retrieves the targeting criteria used by the main page of the VVD (Dutch party) in the last 30 days. Just put in the right Page ID.

last30 <- get_targeting("121264564551002", timeframe = "LAST_30_DAYS")

head(last30, 5)
#> # A tibble: 5 × 16
#>   value      num_ads total…¹ type  locat…² num_o…³ is_ex…⁴ custo…⁵ detai…⁶ ds   
#>   <chr>        <int>   <dbl> <chr> <chr>     <int> <lgl>   <chr>   <chr>   <chr>
#> 1 All              7       1 gend… <NA>         NA NA      <NA>    <NA>    2023…
#> 2 Women            0       0 gend… <NA>         NA NA      <NA>    <NA>    2023…
#> 3 Men              0       0 gend… <NA>         NA NA      <NA>    <NA>    2023…
#> 4 Netherlan…       7       1 loca… countr…       0 FALSE   <NA>    <NA>    2023…
#> 5 13               0       0 age   <NA>         NA NA      <NA>    <NA>    2023…
#> # … with 6 more variables: main_currency <chr>, total_num_ads <int>,
#> #   total_spend_formatted <chr>, is_30_day_available <lgl>,
#> #   is_90_day_available <lgl>, internal_id <chr>, and abbreviated variable
#> #   names ¹​total_spend_pct, ²​location_type, ³​num_obfuscated, ⁴​is_exclusion,
#> #   ⁵​custom_audience_type, ⁶​detailed_type

Get Targeting criteria (Last 7 Days)

The following code retrieves the targeting criteria used by the main page of the VVD (Dutch party) in the last 7 days. Just put in the right Page ID.

last7 <- get_targeting("121264564551002", timeframe = "LAST_7_DAYS")


head(last7, 5)
#> # A tibble: 5 × 16
#>   value      num_ads total…¹ type  locat…² num_o…³ is_ex…⁴ custo…⁵ detai…⁶ ds   
#>   <chr>        <int>   <dbl> <chr> <chr>     <int> <lgl>   <chr>   <chr>   <chr>
#> 1 All              6       1 gend… <NA>         NA NA      <NA>    <NA>    2023…
#> 2 Women            0       0 gend… <NA>         NA NA      <NA>    <NA>    2023…
#> 3 Men              0       0 gend… <NA>         NA NA      <NA>    <NA>    2023…
#> 4 Netherlan…       6       1 loca… countr…       0 FALSE   <NA>    <NA>    2023…
#> 5 13               0       0 age   <NA>         NA NA      <NA>    <NA>    2023…
#> # … with 6 more variables: main_currency <chr>, total_num_ads <int>,
#> #   total_spend_formatted <chr>, is_30_day_available <lgl>,
#> #   is_90_day_available <lgl>, internal_id <chr>, and abbreviated variable
#> #   names ¹​total_spend_pct, ²​location_type, ³​num_obfuscated, ⁴​is_exclusion,
#> #   ⁵​custom_audience_type, ⁶​detailed_type

metatargetr's People

Contributors

favstats avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.