Skip to content

Instantly share code, notes, and snippets.

/* Loads IFrame Player API Code asynchronously */
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
/* Media Module Config */
s.enableVideoTracking=true
if(s.enableVideoTracking){
s.loadModule('Media');
s.Media.autoTrack=false;
s.Media.playerName='YouTube';
s.Media.segmentByMilestones=true;
s.Media.trackMilestones='25,50,75';
s.Media.trackUsingContextData=true;
s.Media.contextDataMapping = {
@33sticks
33sticks / aa-yt-helper.js
Created July 28, 2017 18:32
Adobe Analytics YouTube Player Video Measurement Helper Function
/*YouTube Player updates required by Adobe Video Tracking module */
var n=0;
jQuery('iframe').each(function() {
var src = jQuery(this).attr('src');
if(src){
if (src.indexOf('youtube.com') > -1) {
@33sticks
33sticks / aa-py-remove-header.py
Created July 28, 2017 18:33
This Python script will remove the comment header from a downloaded Adobe Analytics report
#import the pandas library
import pandas as pd
#pull adobe report download into a dataframe; ignorning the comment header
df = pd.read_csv("/Users/jasonthompson/Documents/analysis/python/sp/adobe_id.csv", comment="#", header=1)
#export cleaned data to a new csv file
df.to_csv("/Users/jasonthompson/Documents/analysis/python/sp/adobe_id_no-comments.csv", encoding='utf-8')
@33sticks
33sticks / Identify_Duplicates.py
Created January 16, 2016 18:19
A framework for identifying duplicate sales data using Python.
# We will use data structures and data analysis tools provided in Pandas library
import pandas as pd
# Import retail sales data from an Excel Workbook into a data frame
path = '/Documents/analysis/python/examples/2015sales.xlsx'
xlsx = pd.ExcelFile(path)
df = pd.read_excel(xlsx, 'Sheet1')
# Let's add a new boolean column to our dataframe that will identify a duplicated order line item (False=Not a duplicate; True=Duplicate)
df['is_duplicated'] = df.duplicated(['order_id', 'order_item_id'])
@33sticks
33sticks / server.R
Created October 6, 2020 15:15
Shiny server.R
# Load Shiny
library(shiny)
# Define server logic required to request summary data from Adobe Analytics
shinyServer(function(input, output) {
# Load RSiteCatalyst
library("RSiteCatalyst")
# Listen for a click on the 'Get Report Suite Summary' button
@33sticks
33sticks / url_parser.py
Last active April 25, 2023 04:46
A Python script that takes a CSV file containing URLs, say from a web server log or an analytics platform, and parsing the URLs into URL parts that are then appended to a data frame for further manipulation and/or data analysis.
#import the urlprase library to break url into components
from urlparse import urlparse
#import pandas for data processing
from pandas import DataFrame, Series
import pandas as pd
#import URL data
df = pd.read_csv("/Users/Documents/analysis/my_urls.csv")