GNU Elements

Create your free account

No credit card required. It takes about 30 seconds.

  • 8 or more characters not yet
  • Not a common password not yet
  • Different from your email not yet

By creating an account you agree to our Terms of Service and Privacy Policy.

Already have an account? Sign in
(2.6.0), so the server can tell which // pages that started loading reached this point. var pid = /^[a-f0-9]{16}$/.test(window.GNU_CPID || '') ? window.GNU_CPID : ''; // 2.11.1: automated browser (same rule as GNU Landing 1.6.0, decided again by the server). // A bot sends only its first page view, with the signals; nothing else reaches Insights. // What the page sends to Meta is not touched. var bx = null; try { bx = (function(){var n=navigator,s=window.screen||{},u=n.userAgent||"",o={wd:n.webdriver===true?1:0,sw:+s.width||0,sh:+s.height||0,iw:window.innerWidth||0,ih:window.innerHeight||0,tp:+n.maxTouchPoints||0,gl:window.GNUL_BOT===1?1:0};o.m=/Mobi|Android|iPhone|iPad|iPod|Tablet|Silk|Kindle|PlayBook/i.test(u)||(/Macintosh/.test(u)&&o.tp>1)?1:0;o.b=o.wd||o.gl||(!o.m&&o.sw>0&&o.sh>0&&o.sw<=1024&&o.sh<=768&&o.sw===o.iw&&o.sh===o.ih)?1:0;return o;})(); } catch (e) { bx = null; } var isBot = !!(bx && bx.b); function body(events) { var b = { u: location.href.split('#')[0], r: document.referrer || '', ev: events }; if (test) { b.t = 1; } if (pid) { b.pid = pid; } return JSON.stringify(b); } function send(events, beacon) { if (isBot) { return; } var data = body(events); if (beacon && navigator.sendBeacon) { try { if (navigator.sendBeacon(C.url, new Blob([data], { type: 'application/json' }))) { return; } } catch (e) {} } try { if (window.fetch) { fetch(C.url, { method: 'POST', credentials: 'same-origin', keepalive: true, headers: { 'Content-Type': 'application/json' }, body: data }).catch(function () {}); } } catch (e) {} } function scrollDepth() { var doc = document.documentElement; var h = Math.max(doc.scrollHeight, document.body ? document.body.scrollHeight : 0); var seenTo = (window.pageYOffset || doc.scrollTop || 0) + (window.innerHeight || doc.clientHeight || 0); var pct = h > 0 ? Math.min(100, Math.round(100 * seenTo / h)) : 0; if (pct > maxScroll) { maxScroll = pct; } } function visible() { return visibleMs + (visibleFrom ? Date.now() - visibleFrom : 0); } // The page view goes out first, so the visit and its cookie exist before any click. var nowMs = function () { try { return Math.round(performance.now()); } catch (e) { return 0; } }; var first = { e: 'page_view', v: 0, a: 0, l: nowMs() }; var ctx = { w: window.innerWidth || 0, lang: (navigator.language || '').slice(0, 12) }; try { ctx.tz = Intl.DateTimeFormat().resolvedOptions().timeZone || ''; } catch (e) {} (function () { var b = JSON.parse(body([first])); b.ctx = ctx; if (bx) { b.bx = bx; } var data = JSON.stringify(b); try { if (window.fetch) { fetch(C.url, { method: 'POST', credentials: 'same-origin', keepalive: true, headers: { 'Content-Type': 'application/json' }, body: data }).catch(function () {}); } else if (navigator.sendBeacon) { navigator.sendBeacon(C.url, new Blob([data], { type: 'application/json' })); } } catch (e) {} })(); // Quality visit (2.7.0): 10 s visible and engaged (scrolled 30% or more, saw the plans // or clicked a plan). Once per browser session: recorded in Insights and sent to Meta // through PixelYourSite with a hidden button (custom event "Click on CSS selector" // #pys-hook-gnu-qv; values in #pys-p-gnu-qv-time, #pys-p-gnu-qv-scroll, #pys-p-gnu-qv-page). var qvDone = false; try { qvDone = sessionStorage.getItem('gnu_qv') === '1'; } catch (e) {} var engaged = false; var scrolled = false; function pysHook(secs) { var put = function (id, text) { var el = document.getElementById(id); if (!el) { el = document.createElement('span'); el.id = id; el.hidden = true; document.body.appendChild(el); } el.textContent = String(text); }; put('pys-p-gnu-qv-time', secs); put('pys-p-gnu-qv-scroll', maxScroll); put('pys-p-gnu-qv-page', path); var btn = document.getElementById('pys-hook-gnu-qv'); if (!btn) { btn = document.createElement('button'); btn.id = 'pys-hook-gnu-qv'; btn.type = 'button'; btn.hidden = true; btn.tabIndex = -1; document.body.appendChild(btn); } var tries = 0; (function fire() { if ((window.pysOptions && document.readyState === 'complete') || tries > 20) { try { btn.click(); } catch (e) {} return; } tries++; window.setTimeout(fire, 500); })(); } function maybeQualify() { if (qvDone || !document.body) { return; } var v = visible(); // Scrolled: the visitor moved the page (a short page shows 30% without scrolling). if (v < 10000 || !(engaged || (scrolled && maxScroll >= 30))) { return; } qvDone = true; try { sessionStorage.setItem('gnu_qv', '1'); } catch (e) {} send([{ e: 'quality_visit', v: v }], false); pysHook(Math.round(v / 1000)); } window.addEventListener('scroll', function () { if (!scrolled && (window.pageYOffset || document.documentElement.scrollTop || 0) > Math.min(300, (window.innerHeight || 800) * 0.3)) { scrolled = true; } if (!qvDone) { scrollDepth(); maybeQualify(); } }, { passive: true }); window.addEventListener('scroll', scrollDepth, { passive: true }); window.addEventListener('load', scrollDepth); scrollDepth(); function watchSections() { var names = Object.keys ? Object.keys(C.sections || {}) : []; names.forEach(function (name) { var el = null; try { el = document.querySelector(C.sections[name]); } catch (e) { el = null; } if (!el) { return; } var report = function () { if (seen[name]) { return; } seen[name] = 1; if (name === 'pricing') { engaged = true; maybeQualify(); } send([{ e: 'section_seen', d: name, v: Date.now() - t0 }], false); }; if (window.IntersectionObserver) { var io = new IntersectionObserver(function (entries) { entries.forEach(function (en) { if (en.isIntersecting) { report(); io.disconnect(); } }); }, { threshold: 0.3 }); io.observe(el); } else { window.addEventListener('scroll', function () { var r = el.getBoundingClientRect(); if (r.top < (window.innerHeight || 0) * 0.7 && r.bottom > 0) { report(); } }, { passive: true }); } }); } if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', watchSections); } else { watchSections(); } document.addEventListener('click', function (ev) { var a = ev.target && ev.target.closest ? ev.target.closest('a[href]') : null; if (!a) { return; } var m = String(a.getAttribute('href') || '').match(/[?&](payment|upgrade)=(\d{1,10})/); if (!m) { return; } send([{ e: 'plan_click', k: m[1], d: m[2], v: Date.now() - t0 }], true); engaged = true; maybeQualify(); }, true); // Largest contentful paint of the page, sent with the exit. var lcp = 0; try { if (window.PerformanceObserver) { new PerformanceObserver(function (list) { var en = list.getEntries(); if (en.length) { lcp = Math.round(en[en.length - 1].startTime); } }).observe({ type: 'largest-contentful-paint', buffered: true }); } } catch (e) {} // Visible time so far at 3, 10, 30, 60, 120 and 300 s, so a visit whose exit never // arrives (common in the Instagram app) still has its time on the page. var marks = [3000, 10000, 30000, 60000, 120000, 300000]; var pingTimer = 0; function schedulePing() { window.clearTimeout(pingTimer); if (!marks.length || exited || !visibleFrom) { return; } pingTimer = window.setTimeout(function () { if (exited || !visibleFrom) { return; } scrollDepth(); var v = visible(); while (marks.length && marks[0] <= v + 50) { marks.shift(); } send([{ e: 'page_ping', v: v, s: maxScroll }], false); maybeQualify(); schedulePing(); }, Math.max(200, marks[0] - visible())); } schedulePing(); // Meta pixel and Google Analytics health of the page (2.6.0), checked at 4 s and, if // something is missing, again 8 s later or when the visitor leaves. var pxSent = false; function resourceSeen(re) { if (window.gnuResSeen && window.gnuResSeen(re)) { return true; } try { var list = performance.getEntriesByType ? performance.getEntriesByType('resource') : []; for (var i = 0; i < list.length; i++) { if (re.test(list[i].name)) { return true; } } } catch (e) {} return false; } function sendPixel(beacon) { if (pxSent || !window.gnuPx) { return; } pxSent = true; send([{ e: 'pixel', d: window.gnuPx(C.px || [], resourceSeen), v: Date.now() - t0 }], beacon); } window.setTimeout(function () { if (!window.gnuPx) { return; } if (window.gnuPx(C.px || [], resourceSeen).indexOf('0') === -1) { sendPixel(false); return; } window.setTimeout(function () { sendPixel(false); }, 8000); }, 4000); function exit() { if (exited) { return; } exited = true; scrollDepth(); window.clearTimeout(pingTimer); var out = [{ e: 'page_exit', v: visible(), s: maxScroll, l: lcp }]; if (!pxSent && Date.now() - t0 > 4000 && window.gnuPx) { pxSent = true; out.push({ e: 'pixel', d: window.gnuPx(C.px || [], resourceSeen), v: Date.now() - t0 }); } send(out, true); } document.addEventListener('visibilitychange', function () { if (document.visibilityState === 'hidden') { if (visibleFrom) { visibleMs += Date.now() - visibleFrom; visibleFrom = 0; } exit(); } else if (!visibleFrom) { visibleFrom = Date.now(); schedulePing(); } }); window.addEventListener('pagehide', exit); })(); //# sourceURL=gnu-checkout-pre-js-after