Skip to content

Instantly share code, notes, and snippets.


Manos Parzakonis IronistM

View GitHub Profile
View channel.sql
-- Default Channel Grouping (dimension)
WHEN trafficSource.source = '(direct)' AND (trafficSource.medium = '(not set)' OR trafficSource.medium = '(none)') THEN 'Direct'
WHEN trafficSource.medium = 'organic' THEN 'Organic Search'
WHEN = 'Yes' OR REGEXP_CONTAINS(trafficSource.medium, r'^(social|social-network|social-media|sm|social network|social media)$') THEN 'Social'
WHEN trafficSource.medium = 'email' THEN 'Email'
WHEN trafficSource.medium = 'affiliate' THEN 'Affiliates'
WHEN trafficSource.medium = 'referral' THEN 'Referral'
WHEN REGEXP_CONTAINS(trafficSource.medium, r'^(cpc|ppc|paidsearch)$') AND trafficSource.adwordsClickInfo.adNetworkType != 'Content' THEN 'Paid Search'
View custom.sql
-- Some sample set custom dimensions return null values
-- Custom Dimension XX (User)
index = 3
View puppeteer_datalayer.js
const puppeteer = require('puppeteer')
const browser = await puppeteer.launch()
const page = await browser.newPage()
await page.goto('')
const dl = JSON.parse(
await page.evaluate(() => JSON.stringify(window.dataLayer))
sahava / dataLayerHistory.js
Last active May 20, 2022
JavaScript for persisting dataLayer array and data model composition across pages
View dataLayerHistory.js
(function() {
// Set the timeout for when the dataLayer history should be purged. The default is 30 minutes.
// The timeout needs to be in milliseconds.
var timeout = 30*60*1000;
// Change dataLayerName only if you've defined another named for the dataLayer array in your
// GTM container snippet.
var dataLayerName = 'dataLayer';
// Don't change anything below.
cassiozen /
Last active Apr 9, 2022 — forked from denolfe/
Notes on setting up Pixelbook for development

Pixelbook Setup

Change your channel

Some of the features mentioned in this document only work on the beta or Dev channel. To change your channel:

  1. chrome://help in a browser window
  2. Click Detailed Build Information
  3. Change Channel
  4. Select Beta (Or Dev, if you're feeling adventurous)
postman31 / GTM
Created Aug 1, 2018
Notifies you about pending changes in your GTM workspaces by email
View GTM
function myFunction() {
try {
var message = ''
var response = TagManager.Accounts.list() {
Logger.log('fetching changes for %s',
var containers = TagManager.Accounts.Containers.list(account.path)
if (!containers.container) {
Logger.log('no containers for %s',
sahava / customTaskMonster
Last active Aug 6, 2020
One customTask to rule them all.
View customTaskMonster
var _customTask = function () {
// customTask Builder by Simo Ahava
// More information about customTask:
// Change the default values for the settings below.
// clientIdIndex: The Custom Dimension index to where you want to send the visitor's Client ID.
var clientIdIndex = 1;
CarstVaartjes /
Created Apr 8, 2018
fb-prophet transformation for aws lambda
# based on
$ mkdir ~/.aws
$ cat >> ~/.aws/config
region=YOUR_REGION (such as us-west-2, us-west-1, etc)
mhawksey /
Last active Jan 16, 2020
Snippet of code used for DevFest London 2017 to count faces in audience and send to Google Analytics (see
import io
import picamera
import cv2
import numpy
def hitGA(faces):
print("Sending to GA")
requests.get("" \
+ "&cid=1111" \
bearloga /
Last active Jan 3, 2018
A bash shell script that can be used to turn the current directory into an RStudio project, opening the project in RStudio after creating it.
# Usage: mkproj [projectname]
# projectname defaults to name of current directory
template="Version: 1.0\nRestoreWorkspace: Default\nSaveWorkspace: Default\nAlwaysSaveHistory: Default\n\nEnableCodeIndexing: Yes\nUseSpacesForTab: Yes\nNumSpacesForTab: 4\nEncoding: UTF-8\n\nRnwWeave: knitr\nLaTeX: pdfLaTeX"
wd=$(basename `pwd`)
if [ -z $1 ]; then