User Tools

Site Tools


bidding
###SUMMARY###
## CLICK EVENT
#1# AVERAGE CLICKS PER INSTALL
 
 
# get the data from BQ
 
library(bigrquery)
library(dplyr)
project <- "panda-premium-analytics"
 
# query
 
sql <- "
select *
from adjust.02_mobile_step02 
group by id, log_date, network, event, timestamp, order, bundle_id, fb_campaign, campaign, event_country, ip
order by id, timestamp
"
 
##########################################################
 
data <- query_exec(sql, project = project, max_pages = Inf)
 
#1#
 
data_noinstall <- data
data_install <- data
 
 
# Average number of clicks that yield to no install, per network
 
data_click_to_noinstalls <- data_noinstall %>%
  group_by(id, network) %>%
  filter(first(event)=='click' & last(event)=='click') %>%
  summarise(count=n()) %>%
  group_by(network) %>%
  summarise(avgClicks=mean(count))  
 
 
write.csv(data_click_to_noinstalls, file = '/Users/vincenzo/Desktop/1.install_sale_analysis/ios/IN/2.\ Click\ Analysis')
 
data_click_to_noinstalls <- read.csv('/Users/vincenzo/Desktop/1.install_sale_analysis/ios/IN/2.\ Click\ Analysis/clicknoinstallgraph2.csv') 
 
ggplot(data=data_click_to_noinstalls, aes(x=network, y=avgClicks)) + 
  geom_bar(colour="black", fill="#DD8888", width=.8, stat="identity") +
  xlab("Network") + ylab("Average Clicks") +
  ggtitle("Average number of clicks that yield to no install, per network")
 
write.csv(data_click_to_noinstalls, file = '/Users/vincenzo/Desktop/1.install_sale_analysis/ios/IN/2.\ Click\ Analysis/clicknoinstall.csv')
 
# Average number of clicks that yield to install, per network
 
data_click_to_install <- data %>%
  group_by(id, network) %>%
  filter(first(event)=='click' & last(event)=='install') %>%
  summarise(count=n()) %>%
  group_by(network) %>%
  summarise(avgClicks=mean(count))
 
ggplot(data=data_click_to_install, aes(x=network, y=avgClicks)) + 
  geom_bar(colour="black", fill="#DD8888", width=.8, stat="identity") +
  xlab("Network") + ylab("Average Clicks") +
  ggtitle("Average number of clicks that yield to a install, per network")
 
 
write.csv(sum_click_to_install, file = 'data_click_to_install.csv')
write.csv(data_click_to_install, file = '/Users/vincenzo/Desktop/1.install_sale_analysis/ios/IN/2.\ Click\ Analysis/data_click_to_nointstalls.csv')
bidding.txt · Last modified: 2015/12/16 12:58 by vincenzo