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
// Constant for Measurement ID without G- | |
const MEASUREMENT_ID = 'G-DKNEXDCMS2'; | |
// Function to read cookies | |
function get_ga_clientid_from_cookies() { | |
var cookie = {}; | |
document.cookie.split(';').forEach(function(el) { | |
var splitCookie = el.split('='); | |
var key = splitCookie[0].trim(); | |
var value = splitCookie[1]; | |
cookie[key] = value; |
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
WITH | |
events AS ( | |
SELECT | |
TIMESTAMP_MICROS(event_timestamp) AS event_ts, | |
CONCAT(user_pseudo_id,'-',event_name,'-',CAST(event_timestamp AS STRING)) AS event_id, | |
user_pseudo_id AS user_pseudo_id, | |
user_id, | |
traffic_source.name AS utm_channel, | |
traffic_source.medium AS utm_medium, | |
traffic_source.source AS utm_source, |
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 id="gtm-modern-cookie-replicator"> | |
/** | |
* Modern UTM & Referral Cookie Replicator | |
* | |
* Inspired from the UTMZ cookie replicator, | |
* whose goal was to makes a generally faithful representation | |
* of the old __utmz cookie from Classic Analytics. ; | |
* | |
* the "Modern" cookie replicator | |
* - stores and decodes the cookie as/from JSON format |
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
window.at_exp_earn_version = window.at_earn_exp_version || {}; | |
window.at_exp_club_shopping_version = window.at_exp_club_shopping_version|| {}; | |
window.at_earn_more_text_click = "init"; | |
window.at_club_shopping_show_more_text_click = "init"; | |
function getRandom(arr, n) { | |
var result = new Array(n), | |
len = arr.length, | |
taken = new Array(len); | |
if (n > len) | |
throw new RangeError("getRandom: more elements taken than available"); |
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 getRandom(arr, n) { | |
var result = new Array(n), | |
len = arr.length, | |
taken = new Array(len); | |
if (n > len) | |
throw new RangeError("getRandom: more elements taken than available"); | |
while (n--) { | |
var x = Math.floor(Math.random() * len); | |
result[n] = arr[x in taken ? taken[x] : x]; | |
taken[x] = --len in taken ? taken[len] : len; |
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
var str = 'od3P-t1o5NOTl4ketBHZ1kZ0DBio'; | |
function convert(str) { | |
if (str.length == 28) { | |
var binary = [] | |
var num = [] | |
var binary_str | |
for (var i = 0; i < str.length; i++) { | |
var binStr = str.charCodeAt(i).toString(2).padStart(8, "0"); // 补全为8位数字 ex:01110110 | |
binary.push(binStr); |
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
var nodeExplorer = function (node, key, val, count) { | |
var k, | |
r, | |
j, | |
checkCount = count || 0; | |
if (!!node && node[key] !== undefined) { | |
if(!!val && node[key] === val){ | |
return node; | |
} | |
if(!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 Pii(string){ | |
var piiRegex = [{ | |
name: 'EMAIL', | |
regex: /(\&|\?|\#)(email|e-mail|mail)=[^&#]+/gi | |
},{ | |
name: 'EMAIL', | |
regex: /[^&?=#]+(@|%40)[^@&?=#]+\.[^@&?=#]+/gi | |
},{ | |
name: 'ADDRESS', | |
regex: /(\&|\?|\#)address=[^&#]+/gi |
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
/* | |
* Sample website: https://www.leslipfrancais.fr/maillots-de-bain-326# | |
* If an element is visible, which mean its' top and left both greater than 0 | |
* and its' right and bottom should less than the screen | |
* This is how we know whether an element is on the screen | |
*/ | |
function isVisible(elem) { | |
var location = elem.getBoundingClientRect(); | |
return ( |