Description Usage Arguments Details Author(s) See Also Examples
Returns effective as well as configured status and created time, name, account id of object requested (campaign, adset or ad).
1 | checkStatus(id, token, fields = "effective_status")
|
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 |
fields |
default ( |
configured_status: The configured status of the object (campaign, adset or ad). If object is campaign and this status is PAUSED, all its active ad sets and ads will be paused and have an effective status CAMPAIGN_PAUSED.
effective_status The effective status of this campaign/adset/ad; enum {ACTIVE, PAUSED, DELETED, PENDING_REVIEW, DISAPPROVED, PREAPPROVED, PENDING_BILLING_INFO, CAMPAIGN_PAUSED, ARCHIVED, ADSET_PAUSED}
John Coene jcoenep@gmail.com
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.