#Standard SQL
SELECT
event_date,
COUNT (DISTINCT(user_pseudo_id)) AS user_counts FROM
analyticslog-app-plus-web.analytics_240627631.*
WHERE
event_date BETWEEN '20200801' AND '20200831'
GROUP BY event_date
ORDER BY event_date ASC
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#install packages | |
install.packages("googleAnalyticsR") | |
install.packages("tidyverse") | |
#load libraries | |
library(googleAnalyticsR) | |
library(tidyverse) | |
#creating service account json key | |
#http://code.markedmondson.me/googleAnalyticsR/articles/setup.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#http://code.markedmondson.me/googleAnalyticsR/articles/setup.html | |
install.packages("googleAnalyticsR") | |
library(googleAnalyticsR) | |
#change location to your service key folder | |
ga_auth(json_file = "C:\\location-folder-for your-service-account-json\\service-key.json") | |
account_list <- ga_account_list() | |
account_list$viewId |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
os.environ['GOOGLE_APPLICATION_CREDENTIALS']='your-service-key.json' | |
"""Object tracking in a video stored on GCS.""" | |
from google.cloud import videointelligence | |
video_client = videointelligence.VideoIntelligenceServiceClient() | |
features = [videointelligence.enums.Feature.OBJECT_TRACKING] | |
gcs_uri = 'gs://video_intel3/*.*' | |
output_uri = 'gs://video_intel3/response-multiple-video-intelligence-single-request.json' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#create boxplot with data | |
boxplot <- ggplot(data,aes(x=channel, | |
y= revPerSessionUSD)) + | |
geom_boxplot()+ | |
ggtitle("Revenue Per Session - For Full Year") | |
#show viz | |
boxplot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gadata %>% | |
group_by(as.factor(dayofWeek)) %>% | |
summarise(Min = min(sessions), | |
Max = max(sessions), | |
Median = median(sessions), | |
IQRange = IQR(sessions)) |
SELECT COUNT (DISTINCT(user_pseudo_id)) AS total_users
FROM your-project-table
,
UNNEST (event_params) AS event_param
WHERE event_name = 'page_view'
AND event_param.key = 'medium'
AND event_param.value.string_value = 'organic'
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Custom JS to get age of user in Adobe Launch | |
var x=_satellite.getVar('dataLayer var: DOB'); | |
var dobYear = x.getFullYear(); | |
var curYear = new Date().getFullYear(); | |
var age = curYear - dobYear; | |
return age; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
##geom_histogram | |
ggplot(data=diamonds)+ | |
geom_histogram(mapping=aes(x = carat), | |
binwidth = 0.5) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mean(data_strings_removed$br) | |
sd(data_strings_removed$br) |
OlderNewer