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
<script> | |
//TODO: Anyone using this script will likely want to extend. This is a guide to get started | |
(function(dataLayer){ | |
var i = 0; | |
//array of percentages at which progress notifications are pushed to the dataLayer | |
var markers = [10,25,50,75]; //adjust these values if you want different progress reports | |
var playersMarkers = []; | |
function findObjectIndexById(haystack, key, needle) { |
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
/* | |
* Analytics Pros, 2017 | |
*/ | |
(function(data_layer) { | |
var start_time = Date.now() // start timer on page load | |
// loop through all forms on the page, keep track of index with "i" | |
document.querySelectorAll("form").forEach(function(form,i) { | |
var position_index = 1, |
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
/* | |
* Based on example at https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/clearTimeout | |
* Usage: edit config variables, copy+paste into JS console, type in search field and wait for dataLayer push | |
*/ | |
(function(dL) { | |
/* | |
* Application Functions | |
*/ |
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
// Code Example taken from Jeff Pierce's dataLayer Inspector+ Chrome Extension | |
// https://chrome.google.com/webstore/detail/analytics-pros-datalayer/kmcbdogdandhihllalknlcjfpdjcleom?hl=en-US | |
// create the handler object, and initialize the _gaq array | |
var a = window["_gaq"] = window["_gaq"] || []; | |
// for Data Layer Support: | |
window.dataLayer = window.dataLayer || []; | |
// b() is where you invoke business logic as a result of data pushed in _gaq |
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 two tables: L and R | |
-- content of tables a "val" column with two rows. | |
-- rows in L: "left only" and "both" | |
-- rows in R: "right only" and "both" | |
with l as ( | |
select 'both' as val | |
union | |
select 'left_only' as val | |
), r as ( |
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
-- zjuul wrote: https://gist.github.com/zjuul/aabde0ac52f3ee2974833cde718c56c6 | |
-- I converted to BigQuery syntax: | |
with l as ( | |
select 'both' as val | |
union all | |
select 'left_only' as val | |
), r as ( | |
select 'both' as val | |
union all | |
select 'right_only' as val |
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
function(){ | |
const storageName = "session_id_with_expiry"; | |
function genId() { | |
return ([1e8]+-1e3).replace(/[018]/g, c => | |
(c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16) | |
); | |
} | |
function setSessionId(name, value, ts) { |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.