oRion: 'oRion' Integrate R and Orion.

Description Functions Author(s) Examples

Description

Interact with Cheetah Mobile's Orion Platform from your R console.

Functions

Families.

OAuth

Get

show family Show items

create family Create items

delete family Create items

dict family Fetch dictionaries

update family Update items

list family List items

helpers List items

Author(s)

John Coene [email protected]

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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
## Not run: 
# authenticate
orionOAuth(client.id = 0000,
           client.secret = "0x00000000x00x0x000xxx0000x0xx0")

# set body of campaign
camp <- list(name = "test",
             budget_type = "daily",
             budget_daily = "1000", 
             pkg_name = "test",
             objective = objective("installs"), 
             app_type = "2",
             web_type = "1", 
             landing_page = landingPage("googlePlay"))
             
# create campaign
createCampaign(camp)

# list campaigns
campaigns <- listCampaigns(n = 100)

# pick two random countries                       
locations <- paste0(sample(dictCountry()$code, 1), "|", 
                    sample(dictCountry()$code, 1))
                      
# create audience template to use in adset                        
createAudience(body = list(
   audience_template_name = "test",
   audience_template_desc = "test template",
   country = locations, 
   language = sample(dictLanguage()$code, 1),
   net_type = netType("wifi")),
   interest = dictInterst()$pid[1])

# list audience template
audiences <- listAudiences(n = 50)

# create adset
createAdset(body = list(
   name = "testAdset",
   bid_type = appShowType("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.myApp.io"))

# list adsets
adsets <- listAdsets()

# upload image to use in ad
createImage(file = paste0(.libPaths(), "/png/img/Rlogo.png"))

# list images
images <- listImages()

# define ad settings
body <- list(
   adset_id = adsets$id[1],
   name = "testAd",
   icon_url = images$thumb[1],
   title = "Download oRion",
   desc = "Download oRion and interact with Orion from your R console",
   button_text = buttonText("install"),
   image_url = images$local_url[1])
   
# post ad
createAd(body = body)

# list ads
ads <- listAds()

# update ad name
update <- updateAd(ad.id = ad$id[1], body = list(name = "New Ad Name"))
               
# show updated ad
showAd(ad.id = ads$id[1])

# map ads
map <- map(campaigns, adsets, ads, audiences)
g <- igraph::graph.data.frame(network[,3:4], directed = TRUE)
plot(g)

# get data
# get daily campaign impressions and conversions for the past 7 days
dat <- getReport(column = c("impression", "conversion"), 
                 group.by = c("datetime", "campaign"), 
                 start = Sys.Date() - 7)

## End(Not run)

JohnCoene/oRion documentation built on Jan. 12, 2019, 10:06 a.m.