From 5aba93d8421f2fe9a1c26caedc6e77c1d5cdc81b Mon Sep 17 00:00:00 2001 From: Kevo Date: Mon, 22 Jan 2024 11:10:20 -0800 Subject: [PATCH] Updates --- build.js | 2 +- js/index.js | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/build.js b/build.js index 678cb46..69ae6fa 100644 --- a/build.js +++ b/build.js @@ -1 +1 @@ -!function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(o,i,function(t){return e[t]}.bind(null,i));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){function o(){return amplitude.getInstance()}function i(e){return Array.from(document.querySelectorAll(e))}document.addEventListener("DOMContentLoaded",()=>{console.log("Loaded"),function(){if(window.location.host.startsWith("localhost"))return;o().logEvent("Landing Page View",{page:document.body.dataset.type||document.title});let e=!1;const t=[];window.addEventListener("scroll",n=>{e||(window.requestAnimationFrame(()=>{document.body;const n=this.scrollY/(document.body.clientHeight-window.innerHeight);n>=.25&&!t[0]&&(o().logEvent("Landing Page 25% Scroll Depth"),t[0]=!0),n>=.5&&!t[1]&&(o().logEvent("Landing Page 50% Scroll Depth"),t[1]=!0),n>=.75&&!t[2]&&(o().logEvent("Landing Page 75% Scroll Depth"),t[2]=!0),n>=.95&&!t[3]&&(o().logEvent("Landing Page 100% Scroll Depth"),t[3]=!0),e=!1}),e=!0)}),i("form.subscribe button").forEach(e=>{e.addEventListener("click",()=>{console.log("Subscribe button click."),o().logEvent("Landing Page Subscribe")})}),i("a").forEach(e=>{e.addEventListener("click",()=>{o().logEvent("Landing Page Link Click",{href:e.getAttribute("href"),text:e.innerText})})})}(),function(){let e=!1,t=!1;document.fonts.ready.then(()=>{e=!0,o()});const n=document.querySelector("img.hero");n?n.complete&&0!==n.naturalWidth?(t=!0,o()):n.onload=()=>{t=!0,o()}:t=!0;function o(){e&&t&&document.body.classList.add("loaded")}}(),function(){const e=i(".subscribeForm");if(!e||!e.length)return;e.forEach(e=>{const t=e.querySelector(".submit"),n=e.querySelector('input[type="email"]');t.addEventListener("click",e=>{e.preventDefault();const o=new XMLHttpRequest;let i="http://localhost:5000/mail/subscribe";return i="https://subscribe.learncoupling.com/mail/subscribe",o.open("POST",i),o.addEventListener("load",()=>{t&&(t.disabled=!0,t.innerHTML="Subscribed!")}),o.addEventListener("error",()=>{window.location.href="http://eepurl.com/hfV9gr"}),o.setRequestHeader("Content-Type","application/json;charset=UTF-8"),o.send(JSON.stringify({email:n.value,source:document.title})),!1}),t&&n.addEventListener("keydown",()=>{t.hasAttribute("disabled")&&(t.innerHTML="Subscribe",t.removeAttribute("disabled"))})})}(),function(){const e=i(".iconText"),t=i(".screenshot");setInterval(()=>{const n=window.innerHeight||document.documentElement.clientHeight;for(let t=0;t=0&&o.top+o.height/1.5<=n&&e[t].classList.add("iconTextSectionVisible")}for(let e=0;e=0&&o.top+o.height/1.5<=n&&(t[e].classList.add("screenshotVisible"),"A"===t[e].parentNode.tagName&&t[e].parentNode.classList.add("screenshotVisible"))}},100)}()})}]); \ No newline at end of file +!function(e){var t={};function n(o){if(t[o])return t[o].exports;var i=t[o]={i:o,l:!1,exports:{}};return e[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(o,i,function(t){return e[t]}.bind(null,i));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){function o(e){return Array.from(document.querySelectorAll(e))}document.addEventListener("DOMContentLoaded",()=>{console.log("Loaded"),function(){if(window.location.host.startsWith("localhost"))return;let e=!1;const t=[];window.addEventListener("scroll",n=>{e||(window.requestAnimationFrame(()=>{document.body;const n=this.scrollY/(document.body.clientHeight-window.innerHeight);n>=.25&&!t[0]&&(t[0]=!0),n>=.5&&!t[1]&&(t[1]=!0),n>=.75&&!t[2]&&(t[2]=!0),n>=.95&&!t[3]&&(t[3]=!0),e=!1}),e=!0)}),o("form.subscribe button").forEach(e=>{e.addEventListener("click",()=>{console.log("Subscribe button click.")})}),o("a").forEach(e=>{e.addEventListener("click",()=>{})})}(),function(){let e=!1,t=!1;document.fonts.ready.then(()=>{e=!0,o()});const n=document.querySelector("img.hero");n?n.complete&&0!==n.naturalWidth?(t=!0,o()):n.onload=()=>{t=!0,o()}:t=!0;function o(){e&&t&&document.body.classList.add("loaded")}}(),function(){const e=o(".subscribeForm");if(!e||!e.length)return;e.forEach(e=>{const t=e.querySelector(".submit"),n=e.querySelector('input[type="email"]');t.addEventListener("click",e=>{e.preventDefault();const o=new XMLHttpRequest;let i="http://localhost:5000/mail/subscribe";return i="https://subscribe.learncoupling.com/mail/subscribe",o.open("POST",i),o.addEventListener("load",()=>{t&&(t.disabled=!0,t.innerHTML="Subscribed!")}),o.addEventListener("error",()=>{window.location.href="http://eepurl.com/hfV9gr"}),o.setRequestHeader("Content-Type","application/json;charset=UTF-8"),o.send(JSON.stringify({email:n.value,source:document.title})),!1}),t&&n.addEventListener("keydown",()=>{t.hasAttribute("disabled")&&(t.innerHTML="Subscribe",t.removeAttribute("disabled"))})})}(),function(){const e=o(".iconText"),t=o(".screenshot");setInterval(()=>{const n=window.innerHeight||document.documentElement.clientHeight;for(let t=0;t=0&&o.top+o.height/1.5<=n&&e[t].classList.add("iconTextSectionVisible")}for(let e=0;e=0&&o.top+o.height/1.5<=n&&(t[e].classList.add("screenshotVisible"),"A"===t[e].parentNode.tagName&&t[e].parentNode.classList.add("screenshotVisible"))}},100)}()})}]); \ No newline at end of file diff --git a/js/index.js b/js/index.js index 3b2356f..ad50389 100644 --- a/js/index.js +++ b/js/index.js @@ -8,10 +8,12 @@ document.addEventListener('DOMContentLoaded', () => { function initAnalytics () { if (window.location.host.startsWith('localhost')) { return; } - + + /* amp().logEvent('Landing Page View', { page: document.body.dataset.type || document.title }); + */ let ticking = false; const scrollTracked = []; @@ -21,19 +23,19 @@ function initAnalytics () { const b = document.body; const percent = this.scrollY / (document.body.clientHeight - window.innerHeight); if (percent >= 0.25 && !scrollTracked[0]) { - amp().logEvent('Landing Page 25% Scroll Depth'); + // amp().logEvent('Landing Page 25% Scroll Depth'); scrollTracked[0] = true; } if (percent >= 0.5 && !scrollTracked[1]) { - amp().logEvent('Landing Page 50% Scroll Depth'); + // amp().logEvent('Landing Page 50% Scroll Depth'); scrollTracked[1] = true; } if (percent >= 0.75 && !scrollTracked[2]) { - amp().logEvent('Landing Page 75% Scroll Depth'); + // amp().logEvent('Landing Page 75% Scroll Depth'); scrollTracked[2] = true; } if (percent >= 0.95 && !scrollTracked[3]) { - amp().logEvent('Landing Page 100% Scroll Depth'); + // amp().logEvent('Landing Page 100% Scroll Depth'); scrollTracked[3] = true; } ticking = false; @@ -45,16 +47,18 @@ function initAnalytics () { $$('form.subscribe button').forEach(btn => { btn.addEventListener('click', () => { console.log('Subscribe button click.'); - amp().logEvent('Landing Page Subscribe'); + // amp().logEvent('Landing Page Subscribe'); }); }); $$('a').forEach(link => { link.addEventListener('click', () => { + /* amp().logEvent('Landing Page Link Click', { href: link.getAttribute('href'), text: link.innerText }); + */ }); }); } @@ -183,6 +187,6 @@ function click (q, fn) { } } -function amp () { return amplitude.getInstance(); } +// function amp () { return amplitude.getInstance(); } function $ (q) { return document.querySelector(q); } function $$ (q) { return Array.from(document.querySelectorAll(q)); }