瀏覽代碼

Fix counter.dev analytics (#674)

Emruz Hossain 2 年之前
父節點
當前提交
33c10915a8
共有 1 個文件被更改,包括 4 次插入20 次删除
  1. 4 20
      layouts/partials/analytics.html

+ 4 - 20
layouts/partials/analytics.html

@@ -10,26 +10,10 @@
 
         <!-- Counter.dev -->
         {{ with .counterDev }}
-            <script>
-            if (
-                !sessionStorage.getItem("_swa") &&
-                document.referrer.indexOf(location.protocol + "//" + location.host) !== 0
-            ) {
-                fetch(
-                "https://counter.dev/track?" +
-                    new URLSearchParams({
-                    referrer: document.referrer,
-                    screen: screen.width + "x" + screen.height,
-                    user: "{{ .id }}",
-                    utcoffset: "1",
-                    }),
-		    {{ with .referrerPolicy }}
-			    { referrerPolicy: "{{ . }}" }
-		    {{ end }}
-                );
-            }
-            sessionStorage.setItem("_swa", "1");
-            </script>
+            <script src="https://cdn.counter.dev/script.js"
+                data-id="{{ .id }}"
+                data-utcoffset="1"
+            ></script>
         {{ end }}
 
         <!-- GoatCounter -->