fb_ads: Facebook Ads API

fb_adsR Documentation

Facebook Ads API

Description

This returns all available FB ads for any account, campaign, or ad set id. For more information on Ad' API, go to the original documentaion

Usage

fb_ads(
  token,
  which,
  start_date = Sys.Date() - 31,
  end_date = Sys.Date(),
  fields = NA,
  api_version = NULL,
  process = TRUE,
  ...
)

Arguments

token

Character. Valid access token with sufficient privileges. Visit the Facebook API Graph Explorer to acquire one.

which

Character vector. This is the accounts, campaigns, adsets, or ads IDs to be queried. Remember: if report_level = "account", you must start the ID with act_.

start_date, end_date

Character. The first and last full day to report, in the format "YYYY-MM-DD".

fields

Character, json format. Leave NA for default fields OR NULL to ignore.

api_version

Character. Facebook API version.

process

Boolean. Process GET results to a more friendly format?

...

Additional parameters.

Details

This function was based on FBinsightsR.

Value

data.frame with un-nested processed results if process=TRUE or raw API results as list when process=FALSE.

See Also

Other API: bring_api(), fb_accounts(), fb_creatives(), fb_insights(), fb_process(), fb_report_check(), fb_rf(), fb_token(), gemini_ask(), gpt_ask(), li_auth(), li_profile(), queryGA(), slackSend()

Other Meta: fb_accounts(), fb_creatives(), fb_insights(), fb_process(), fb_report_check(), fb_rf(), fb_token()

Examples

## Not run: 
token <- YOURTOKEN
account <- act_ADACCOUNT

# Query all ads for "which" (account) with results in the last 10 days
ads <- fb_ads(token, account, start_date = Sys.Date() - 10)

## End(Not run)

laresbernardo/lares documentation built on Oct. 23, 2024, 12:05 p.m.