Skip to content

Instantly share code, notes, and snippets.

View MarkEdmondson1234's full-sized avatar
🦑
Tappity tap tap

Mark Edmondson MarkEdmondson1234

🦑
Tappity tap tap
View GitHub Profile
@MarkEdmondson1234
MarkEdmondson1234 / google_analytics_bigquery_user_mapping_table_customer.sql
Last active October 12, 2021 07:50 — forked from krisjan-oldekamp/google_analytics_bigquery_user_mapping_table_customer.sql
How to create a user mapping table (or Identity Graph) based on all the available user identifiers in the Google Analytics 4 BigQuery exports (like device-IDs or customer-IDs). Full article on stacktonic.com
-- Author: Krisjan Oldekamp
-- https://stacktonic.com/article/create-a-user-mapping-table-based-on-the-google-analytics-4-big-query-dataset
DECLARE
lookback_window INT64 DEFAULT 90; -- How many days to lookback into the dataset to search for IDs (compared to today)
-- Deduplicate array of struct
CREATE TEMP FUNCTION
DEDUP(val ANY TYPE) AS ((
SELECT
ARRAY_AGG(t)
FROM (
@MarkEdmondson1234
MarkEdmondson1234 / fb-ios14-email.md
Last active April 22, 2021 07:19
Facebook Marketing Partners Team response for Apple's iOS14 Privacy prompt

Hi Mark,

Yesterday (April 20, 2021), Apple confirmed it will make iOS 14.5 available to all iOS users next week, and it will start requiring apps in the App Store to obtain permission through its AppTrackingTransparency framework to “track” users across apps and websites owned by third parties for advertising and measurement purposes.

With the general availability of iOS 14.5 (week of April 26), we will begin rollout of our new advertiser experiences and measurement protocols – including Apple’s SKAdNetwork API (SKAN) and Facebook’s Aggregated Event Measurement (AEM). Once the specific date of the general availability release of 14.5 is confirmed, we will establish the rollout timing of our new experiences and communicate this timing.

You and your clients can expect to see changes in our business and advertising tools, campaign set up, targeting, delivery, measurement, and reporting, following the release of iOS 14.5 and Apple’s prompt enforcement. We are sharing a summary of these changes below, as well a

# This example demonstrates running furrr code distributed on 2 AWS instances ("nodes").
# The instances have already been created.
library(future)
library(furrr)
# Two t2.micro AWS instances
# Created from http://www.louisaslett.com/RStudio_AMI/
public_ip <- c("34.205.155.182", "34.201.26.217")
@MarkEdmondson1234
MarkEdmondson1234 / month_start_end.R
Created March 9, 2018 10:56
Create month start and end dates for a date range you pass in
add_months <- function(date, n){
seq(date, by = paste (n, "months"), length = 2)[2]
}
make_date_ranges <- function(start, end){
starts <- seq(from = start,
to = Sys.Date()-1 ,
by = "1 month")
library("RSiteCatalyst")
library("dplyr")
SCAuth("[email protected]:xxx", "xxx")
reportSuites <- GetReportSuites()
evar <- GetEvars(reportSuites$rsid) #%>%
# reportSuite <- reportSuites$rsid
@MarkEdmondson1234
MarkEdmondson1234 / global.R
Created December 1, 2017 16:39 — forked from raymondben/global.R
gauth shiny example
library(googleAuthR)
library(shiny)
library(shinyjs)
@MarkEdmondson1234
MarkEdmondson1234 / google_calendar_demo.R
Last active September 12, 2024 19:22
A demo of calling Google Calendar API
library(googleAuthR)
## set scopes for calendar
options(googleAuthR.scopes.selected = "https://www.googleapis.com/auth/calendar.readonly",
googleAuthR.client_id = "XXXX", ## add your Google project client Id
googleAuthR.client_secret = "XXXX") ## add your Google project client secret
## make sure calendar API is activated for your Google Project at below URL:
# https://console.cloud.google.com/apis/api/calendar-json.googleapis.com/overview
@MarkEdmondson1234
MarkEdmondson1234 / app.R
Last active August 5, 2024 15:23 — forked from jcheng5/app.R
Using OAuth2 with Shiny
library(shiny)
# WARNING: This sketch does not make proper use of the "state" parameter.
# Doing so usually involves using cookies, which can be done with the
# Rook package but I have not done that here. If you choose to use this
# approach in production, please check the state parameter properly!
APP_URL <- if (interactive()) {
# This might be useful for local development. If not, just hardcode APP_URL
# to the deployed URL that you'll provide a few lines below.
@MarkEdmondson1234
MarkEdmondson1234 / massiveCPUonGCE.R
Last active April 22, 2018 23:46
Run massive parallel R jobs cheaply on Google Compute Engine with googleComputeEngineR and future
## see also http://blog.revolutionanalytics.com/2017/06/doazureparallel-updated.html on how to run on Azure
## and cloudyr project for AWS https://github.com/cloudyr/aws.ec2
# now also in docs: https://cloudyr.github.io/googleComputeEngineR/articles/massive-parallel.html
library(googleComputeEngineR)
library(future)
## auto auth to GCE via environment file arguments
@MarkEdmondson1234
MarkEdmondson1234 / knit_cloudstorage.rmd
Created April 21, 2017 07:53 — forked from mwhitaker/knit_cloudstorage.rmd
Use googleCloudStorageR to automatically upload to Cloud Storage
---
title: "Host image files on Google Cloud storage"
author: "Michael Whitaker"
date: "January 12, 2017"
output:
html_document:
self_contained: false
---
```{r setup, include=FALSE}