Skip to content

Instantly share code, notes, and snippets.

function flatten = (arr = [], result = [], depth) => {
depth--;
for (var i = 0, length = arr.length; i < length; i++) {
var value = arr[i];
if (depth > -1 && Array.isArray(value))
flatten(value, result, depth);
else
result.push(value);
}
/*
This code will live on every single page.
It is a replacement for manually adding static script tags
to each page and it informs the gftracker with all
the information it needs. Also, you are not limited to just
the 4 examples you provided in case you need to add more later.
*/
function affiliate(id = '', product = '') {
var url = 'https://www.gftracker.com/rd/jpx.php',
get = { sid: 24, transid: id, event: product }