checkStatus: Check object status

Description Usage Arguments Details Author(s) See Also Examples

View source: R/checkStatus.R

Description

Returns effective as well as configured status and created time, name, account id of object requested (campaign, adset or ad).

Usage

1
checkStatus(id, token, fields = "effective_status")

Arguments

id

The id of the campaign, adset or ad you want to retrieve (Required), see how to find yours.

token

A valid token as returned by fbAuthenticate or a short-term token from facebook Graph API Explorer.

fields

default ("effective_status") returns the most popular ones. Run findFields to see all valid fields.

Details

Author(s)

John Coene jcoenep@gmail.com

See Also

grabAds

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
## Not run: 
# set token
TK <- "XXXXXXXXXXXXXXXX"

# get information on account
ads <- grabAds(account.id = "act_123456789012345", token = TK)

# loop through ads to find active one (to then get data)
i <- 1

while (status != "ACTIVE"){

   # check status
   status <- checkStatus(ads$id[i], TK)[,effective_status]

   # iterate
   i <- i + 1

   # stop if all ads gone through
   if(i == nrow(ads)) stop("No ACTIVE ads found", call. = FALSE)
}

# exctract active ad
active_ad <- ad[i,]

# get data
ad_data <- getAd(active_ad)

## End(Not run)

JohnCoene/fbadsinsightsr documentation built on May 28, 2019, 12:55 p.m.