#' Create an adset
#'
#' @description Create an adset.
#'
#' @param body body of request that includes adset settings. See examples
#' and details
#'
#' @examples
#' \dontrun{
#' # authenticate
#' orionOAuth(client.id = 0000,
#' client.secret = "0x00000000x00x0x000xxx0000x0xx0")
#'
#' # list of campaigns
#' camps <- listCampaigns()
#'
#' # list of audience templates
#' audiences <- listAudiences()
#'
#' # create adset using random template, in random campaign
#' createAdset(body = list(
#' name = "testAdset",
#' bid_type = bidType("cpi"),
#' unit_price = 1000,
#' budget_lifetime = 10000,
#' campaign_id = sample(camps$id, 1),
#' audience_create_way = 2,
#' app_show_type = appShowType("newsfeed"),
#' audience_template_id = sample(audiences$id, 1),
#' click_url = "http://app.adjust.io"))
#' }
#'
#' @details Valid adset settings (\code{body}):
#' \itemize{
#' \item \code{campaign_id} The campaign id which the ad set is to belongs to
#' \item \code{audience_create_way} \code{0}: Create audience targeting
#' parameters directly. Audience should be along with this API if choose this
#' audience_create_way. \code{1}: Create audience targeting by a template.
#' Note: Once audience created, any changes made on the template will not
#' affect this audience.
#' \item \code{audience_template_id} Required when \code{audience_create_way}:
#' \code{1} or \code{2}
#' \item \code{bid_type} Use \code{\link{bidType}} to generate otherwise,
#' \code{1}: Install (CPI) [Only for KA user],
#' \code{3}: Click (CPC), \code{4} Impressions (CPM)
#' \item \code{app_show_type} Use \code{\link{appShowType}} to generate otherwise,
#' \code{50000}: Native News Feed,
#' \code{50001}: Mini Native News Feed, \code{50003}: Video Ad,
#' \code{50008}: App Locker Ad
#' \item \code{name} Ad set name (unique)
#' \item \code{unit_price} Unit Price. Amount you want to spend to pay per click
#' (CPC) or per 1,000 impressions (CPM)
#' \item \code{click_url} click_url, protocol is required (http://, https://).
#' \item \code{deeplink} Deep link is the ability to link into a specific page
#' or function inside of your app, making an app linkable just like a web site.
#' If you are only targeting people who already installed your app, you do not
#' need to add deferred deep linking. Used when the objective of campaign which
#' ad set belonged to is "Get App Reengagement" (\code{objective = 4})
#' \item \code{imp_url} Impression Tracking. An Impression tracking is an
#' optional URL that allows you to track how many people viewed your ads
#' through third-party tracking system, and our system supported macro is Gaid,
#' e.g. http://host/imp?gaid={gaid}. Used when the bid type is "CPM"
#' \code{bid_type = 4}
#' \item \code{budget_lifetime} Your budget is the maximum amount you want to
#' spend. If you choose lifetime, the amount you enter is the maximum you'll
#' spend during the lifetime of your ad set. At least one of \code{budget_daily}
#' and \code{budget_lifetime} is filled.
#' \item \code{budget_daily} Your budget is the maximum amount you want to
#' spend. If you choose Per Day, the amount you enter is the maximum you'll
#' spend each day. At least one of "budget_daily" and "budget_lifetime" is
#' filled.
#' \item \code{start_time} Start time for the adset (i.e.: \code{2015-09-09 10:10})
#' \item \code{end_time} End time for the adset (i.e.: \code{2015-09-09 10:10})
#' \item \code{ad_scheduling} Your ad set will either run continuously within
#' some days or within some hours range you select. (\code{JSON})
#' i.e.: \code{{1:[1,2],7:[1,2,23]}}
#' \item \code{delivery_type} Use \code{\link{deliveryType}} to generate otherwise,
#' \code{0}: Standard delivery,
#' \code{1}: Accelerated delivery.
#' Standard delivery is recommended and the preferred option for most
#' advertisers. Accelerated delivery can be useful for promoting time-sensitive
#' events and quickly reaching a target audience.
#' \item \code{target_cpi} Target CPI. Only for KA user. \code{3}: Click (CPC)
#' \item \code{freq_type} Frequency Capping type. Frequency capping controls
#' frequency capping of the ad set per user.
#' \item \code{freq_times} Frequency Capping type. Frequency capping controls
#' frequency capping of the ad set per user.
#' \item \code{country} Audience country code. Narrow your potential audience
#' to the people in those countries. Using '|' separated if more than one country.
#' i.e.: \code{US|ID|CN}. See \code{\link{dictCountry}}
#' \item \code{language} Audience language code, i.e.: \code{en} see
#' \code{\link{dictLanguage}}
#' \item \code{gender} Use \code{\link{gender}} to generate otherwise,
#' \code{0}: All, \code{1}: Male, \code{2} Female
#' \item \code{age} Audience age. Use \code{\link{age}} to generate otherwise,
#' \code{1}: 18-24, \code{2}: 25-30,
#' \code{3}: 32-40, \code{4}: 41+.
#' \item \code{interest} Audience interest. Reach users based on their specific
#' interests. See \code{\link{dictInterest}}
#' \item \code{behavior} Audience behavior. Reach users based on app usage and
#' other behaviors. See \code{\link{dictBehaviour}}
#' \item \code{device_brand} Audience device brand. See \code{\link{dictDevice}}
#' \item \code{min_device_os} Min OS version of audience used, blank for
#' unrestricted. See \code{\link{dictOS}}
#' \item \code{max_device_os} Max OS version of audience used, blank for
#' unrestricted. See \code{\link{dictOS}}
#' \item \code{net_type} Use \code{\link{netType}} to generate otherwise,
#' \code{0}: All, \code{1}: Wifi, \code{2}: 2G/3G/4G
#' \item \code{dsp_url} Bid request url of DSP when this pre-targeting
#' condition meets.
#' }
#'
#' @seealso \code{\link{orionOAuth}}, \code{\link{createCampaign}},
#' \code{\link{helpers}}
#'
#' @author John Coene \email{jcoenep@@gmail.com}
#'
#' @export
createAdset <- function(body){
if (class(body) != "list"){
stop("body must be a list. see examples", call. = FALSE)
}
result <- createObject(body = body, object = "adset")
return(result)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.