Description Usage Arguments Details Value Author(s) See Also Examples
Get insights on advertising performances of an ad, an adset, a campaign or even an account. This function may relace any other GET function in this package.
1 2 3 4 |
id |
The id of the object you want to retrieve (Required), see how to find yours. |
token |
A valid token as returned by |
fields |
There are in total 73 valid fields defaults to
( |
n |
Number of results to retrieve, defaults to |
action.attribution.windows |
Determines what is the attribution window for the actions.
For example, |
action.breakdowns |
How to break down action results. Supports more than one breakdowns
(Optional). Run |
action.report.time |
Determines the report time of action stats.
For example, if a person saw the ad on Jan 1st but converted on Jan 2nd,
when you query the API with |
breakdowns |
How to break down the result. Does not support more than one breakdown,
except |
date.preset |
Represents a relative time range (Optional). This field is ignored if
|
level |
Represents the level of result (Optional). Must be one of |
time.increment |
If it is an integer, it is the number of days from 1 to 90.
After you pick a reporting period by using |
time.range |
time range must be |
summary |
Default value: |
verbose |
Defaults to |
limit |
Number of results requested at each API call, defaults to 100.
Sometimes useful to bring it down if many results ( |
This function refers to the following API call https://developers.facebook.com/docs/marketing-api/reference/ad-account/insights/,
it is strongly encouraged to have a look a the latter link.
only the following parameters are not available default_summary
,
filtering
, summary
, sort
and time_ranges
.
getAny
may replace any other GET function. Indeed all functions share the same parameters and fields, the data that is returned solely depend on the object id the functions is fed. See examples.
Note that if summary is TRUE
the function returns a
list
John Coene jcoenep@gmail.com
fbAuthenticate
, findParams
,
grabAds
, grabAdsets
,
grabCampaigns
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 30 31 | ## Not run:
# run authentication with your app details
fbOAuth <- fbAuthenticate(app.id = "1234567890123456",
app.secret = "76xx79121xx0130x2x10a08x3e2x80xx",
scope = "ads_management")
# get ads on account
ads <- grabAds(id = "act_1014262775316748", token = TK)
# get adsets on account
adsets <- grabAdsets(id = "act_1014262775316748", token = TK)
# get ads on account
camp <- grabCampaigns(id = "act_1014262775316748", token = TK)
# get date.preset (this quarter)
date <- findParams("date.preset")[grep("quarter", findParams("date.preset"))]
# fetch Ad data
dat <- getAny(id = sample(ads$id, 1), token = TK, date.preset = date)
# fetch Adset data
dat <- getAny(id = sample(adsets$id, 1), token = TK, date.preset = date)
# fetch Campaign data
dat <- getAny(id = sample(campaigns$id, 1), token = TK, date.preset = date)
# fetch Account data
dat <- getAny(id = "act_1014262775316748", token = TK, date.preset = date)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.