Skip to content

Instantly share code, notes, and snippets.

@edmeehan-tcg
edmeehan-tcg / polling.js
Created May 3, 2018 20:37
Ugly Polling Loop
var myVar = setInterval(function(){
if(document.getElementById("test").classList.contains(className)) {
clearInterval(myVar);
// do stuff here.
}
}, 5000);
@edmeehan-tcg
edmeehan-tcg / dataLayer.js
Last active January 5, 2018 01:46
Marketing Data Layer
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
/*
* Transaction property should be hit scoped
* - fires one time per event and only for a single request
*/
transaction : {
vertical : 'phone|background|email',
type : 'acquisition|upsell|cross-sell',
is_trial : true|false,
(function (window, document) {
if (window.myfbq) return;
window.myfbq = (function () {
if (arguments.length > 0) {
var pixelId, trackType, contentObj;
if (typeof arguments[0] == 'string') pixelId = arguments[0];
if (typeof arguments[1] == 'string') trackType = arguments[1];
if (typeof arguments[2] == 'object') contentObj = arguments[2];