getAccount: Get data on an account

Description Usage Arguments Details Author(s) See Also Examples

View source: R/getAccount.R

Description

Get insights on advertising performances of ad account. See documentation for more information

Usage

1
2
3
4
getAccount(account.id, token, fields = "default", n = 100,
  action.attribution.windows, action.breakdowns, action.report.time, breakdowns,
  date.preset, level, time.increment, time.range, summary = FALSE,
  verbose = FALSE, limit = 100)

Arguments

account.id

Your ad account id, starting by "act_" and followed by 15-16 digits (Required), see how to find yours. how to find yours.

token

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

fields

There are in total 73 valid fields defaults to (default) which returns the most popular ones. Run findFields to see all valid fields to see all valid fields.

n

Number of results to retrieve, defaults to 100. When you make an API request, you will usually not receive all of the results of that request in a single response. This is because some responses could contain thousands of objects so most responses are paginated by default.

action.attribution.windows

Determines what is the attribution window for the actions. For example, c("28d_click") means the API returns all actions that happened 28 days after someone clicked on the ad (Optional). See details below for valid values.

action.breakdowns

How to break down action results. Supports more than one breakdowns (Optional). Run findParams to see all valid action breakdowns.

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 action.report.time="impression", you will see a conversion on Jan 1st. When you query the API with action.report.time="conversion", you will see a conversion on Jan 2nd (Optional).

breakdowns

How to break down the result. Does not support more than one breakdown, except c("age", "gender") and "impression_device", "placement". The option impression_device cannot be used by itself (Optional). Run findParams to see all valid breakdowns.

date.preset

Represents a relative time range (Optional). This field is ignored if time.range is specified. Run findParams to see all valid presets.

level

Represents the level of result (Optional). Must be one of ad, adset, campaign, account.

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 or date.preset, you may choose to have the results for the whole period, or have results for smaller time slices. If "all_days" is used, it means one result set for the whole period. If "monthly" is used, you will get one result set for each calendar month in the given period. Or you can have one result set for each N-day period specified by this param.

time.range

time range must be c(since = 'YYYY-MM-DD', until='YYYY-MM-DD')

summary

Default value: false Determine whether to return a summary section with the same fields as specified by fields will be included in the summary section.

verbose

Defaults to FALSE if TRUE will print information on the queries in the console.

limit

Number of results requested at each API call, defaults to 100. Sometimes useful to bring it down if many results (n) are required as the API might otherwise return error_code: 1 or in other words an "Unknown error".

Details

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.

Author(s)

John Coene jcoenep@gmail.com

See Also

fbAuthenticate

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
## Not run: 
# run authentication with your app details
fbOAuth <- fbAuthenticate(app.id = "1234567890123456", 
                          app.secret = "76xx79121xx0130x2x10a08x3e2x80xx", 
                          scope = "ads_management")

# fetch Account data broken down by action destinations
data <- getAccount(account.id = "act_123456789012345", token = fbOAuth, 
                   action.breakdowns = "action_destination")

## End(Not run)

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