From f70f5c69eff684e45a4ed376c6b59615c76e5859 Mon Sep 17 00:00:00 2001 From: John Clover Date: Thu, 24 Aug 2023 15:59:18 -0400 Subject: [PATCH 1/4] remove heap, add GA --- src/pages/_app.jsx | 42 +++++++++--------------------------------- 1 file changed, 9 insertions(+), 33 deletions(-) diff --git a/src/pages/_app.jsx b/src/pages/_app.jsx index fd42250..53d658b 100644 --- a/src/pages/_app.jsx +++ b/src/pages/_app.jsx @@ -10,39 +10,15 @@ if ( typeof window !== "undefined" && window.location.host === "docs.goldsky.com" ) { - (window.heap = window.heap || []), - (heap.load = function (e, t) { - (window.heap.appid = e), (window.heap.config = t = t || {}); - var r = document.createElement("script"); - (r.type = "text/javascript"), - (r.async = !0), - (r.src = "https://cdn.heapanalytics.com/js/heap-" + e + ".js"); - var a = document.getElementsByTagName("script")[0]; - a.parentNode.insertBefore(r, a); - for ( - var n = function (e) { - return function () { - heap.push([e].concat(Array.prototype.slice.call(arguments, 0))); - }; - }, - p = [ - "addEventProperties", - "addUserProperties", - "clearEventProperties", - "identify", - "resetIdentity", - "removeEventProperty", - "setEventProperties", - "track", - "unsetEventProperty", - ], - o = 0; - o < p.length; - o++ - ) - heap[p[o]] = n(p[o]); - }); - heap.load("303099433"); + var r = document.createElement('script'); + r.src = "https://www.googletagmanager.com/gtag/js?id=G-PGSF5CGSKR"; + r.async = true; + var i = document.getElementsByTagName('script')[0] + i.parentNode.insertBefore(r, i) + window.dataLayer = window.dataLayer || []; + function gtag(){dataLayer.push(arguments);} + gtag('js', new Date()); + gtag('config', 'G-PGSF5CGSKR'); } function getNodeText(node) { From 6625b750afb9569c8bcaceacd2597c08d22b1d39 Mon Sep 17 00:00:00 2001 From: John Clover Date: Thu, 24 Aug 2023 16:02:17 -0400 Subject: [PATCH 2/4] want to test on vercel --- src/pages/_app.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/_app.jsx b/src/pages/_app.jsx index 53d658b..7de80d1 100644 --- a/src/pages/_app.jsx +++ b/src/pages/_app.jsx @@ -8,7 +8,7 @@ import "@/styles/tailwind.css"; if ( typeof window !== "undefined" && - window.location.host === "docs.goldsky.com" + window.location.host === "docs-git-addga-goldsky.vercel.app" ) { var r = document.createElement('script'); r.src = "https://www.googletagmanager.com/gtag/js?id=G-PGSF5CGSKR"; From 130de93ef7e2fb657d7a8562b05c0266a199c4c4 Mon Sep 17 00:00:00 2001 From: John Clover Date: Thu, 24 Aug 2023 16:04:17 -0400 Subject: [PATCH 3/4] looks like it works --- src/pages/_app.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/_app.jsx b/src/pages/_app.jsx index 7de80d1..53d658b 100644 --- a/src/pages/_app.jsx +++ b/src/pages/_app.jsx @@ -8,7 +8,7 @@ import "@/styles/tailwind.css"; if ( typeof window !== "undefined" && - window.location.host === "docs-git-addga-goldsky.vercel.app" + window.location.host === "docs.goldsky.com" ) { var r = document.createElement('script'); r.src = "https://www.googletagmanager.com/gtag/js?id=G-PGSF5CGSKR"; From 350627b07a187804da859818b9dcd0bdbc926f7a Mon Sep 17 00:00:00 2001 From: John Clover Date: Thu, 24 Aug 2023 16:56:15 -0400 Subject: [PATCH 4/4] keep heap in parallel to validate --- src/pages/_app.jsx | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/src/pages/_app.jsx b/src/pages/_app.jsx index 53d658b..c45e605 100644 --- a/src/pages/_app.jsx +++ b/src/pages/_app.jsx @@ -19,6 +19,39 @@ if ( function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'G-PGSF5CGSKR'); + (window.heap = window.heap || []), + (heap.load = function (e, t) { + (window.heap.appid = e), (window.heap.config = t = t || {}); + var r = document.createElement("script"); + (r.type = "text/javascript"), + (r.async = !0), + (r.src = "https://cdn.heapanalytics.com/js/heap-" + e + ".js"); + var a = document.getElementsByTagName("script")[0]; + a.parentNode.insertBefore(r, a); + for ( + var n = function (e) { + return function () { + heap.push([e].concat(Array.prototype.slice.call(arguments, 0))); + }; + }, + p = [ + "addEventProperties", + "addUserProperties", + "clearEventProperties", + "identify", + "resetIdentity", + "removeEventProperty", + "setEventProperties", + "track", + "unsetEventProperty", + ], + o = 0; + o < p.length; + o++ + ) + heap[p[o]] = n(p[o]); + }); + heap.load("303099433"); } function getNodeText(node) {