This repository has been archived by the owner on May 25, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
209 lines (201 loc) · 9.52 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
<head>
<title>Poketale Anylitcs</title>
<link
href="https://fonts.googleapis.com/css2?family=Inter:wght@900&family=Sigmar+One&display=swap"
rel="stylesheet"
/>
<link href="/media/ptlogo.svg" rel="icon" />
<style>
body{background-color:#23272a}h1{color:#fff;font-family:Inter,sans-serif}h2{color:#fff}p{color:#fff;font-family:Inter,sans-serif}h4{color:#fff}p{color:#fff}ohyeah{color:#fff}.jumbotron{background-color:#1f1c1c;margin:50px;padding:15px;margin-bottom:20px}li{font-family:Inter}body{overflow-y:hidden}
</style>
<link rel="stylesheet" href="/media/index.bb6bda39.css" />
</head>
<body>
<div align="center" style="backgorund-color:#434a50">
<div style="background-color:#5da4dc">
<img src="/media/ptlogo.svg" />
<h1>Poketale Anylitcs</h1>
<p>Privacy by Design</p>
<hr />
</div>
<p>
At Poketale, we do not collect or share personal information. To improve
our products, we had to create a completely anonymous way to figure out
how the Poketale products are being used.
</p>
<p>
So we used PostHogs open-source analytics tool on Poketale, then we made a
snippet that uses the "Do Not Track" feature and made it<a
href="https://github.com/iamashley0/poketale-anylitcs-snippet"
>open source.</a
>Poketale Studios only sees the following data:<br />1. How many requests
are made to the website (e.g. 420 requests today).
</p>
<p>
And that's it. We don't collect any more information than the ones
specified above, we promise.
</p>
<br /><br /><br />
<p>p.s: i love you <3</p>
</div>
<script>
/*
Copyright (C) 2021-2022 Ashley (https://github.com/iamashley0/poketale-anylitcs-snippet)
This Source Code Form is subject to the terms of the Mozilla Public
- License, v. 2.0. If a copy of the MPL was not distributed with this file,
- You can obtain one at http://mozilla.org/MPL/2.0/
*/
function _dntEnabled(dnt, userAgent) {
/*
* Returns true or false based on whether doNotTack is enabled. It also takes into account the
* anomalies, such as !bugzilla 887703, which effect versions of Fx 31 and lower. It also handles
* IE versions on Windows 7, 8 and 8.1, where the DNT implementation does not honor the spec.
* @see https://bugzilla.mozilla.org/show_bug.cgi?id=1217896 for more details
*/
let dntStatus = dnt || navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack;
const ua = userAgent || navigator.userAgent;
const anomalousWinVersions = ["Windows NT 6.1", "Windows NT 6.2", "Windows NT 6.3"];
const fxMatch = ua.match(/Firefox\/(\d+)/);
const ieRegEx = /MSIE|Trident/i;
const isIE = ieRegEx.test(ua);
const platform = ua.match(/Windows.+?(?=;)/g);
if (isIE && typeof Array.prototype.indexOf !== "function") {
return false;
} else if (fxMatch && parseInt(fxMatch[1], 10) < 32) {
dntStatus = "Unspecified";
} else if (isIE && platform && anomalousWinVersions.indexOf(platform.toString()) !== -1) {
dntStatus = "Unspecified";
} else {
dntStatus = { 0: "Disabled", 1: "Enabled" }[dntStatus] || "Unspecified";
}
return dntStatus === "Enabled" ? true : false;
}
// This function consolidates parameters
// for the initial ping to FxA metrics endpoint
// we want to send UTMs, entrypoint and formType
// UTMs are added as default values if they don't
// exist on the window
// see https://mozilla.github.io/ecosystem-platform/docs/relying-parties/metrics-for-relying-parties
function setFxAInitialParams() {
const utms = ["source", "campaign", "content", "term", "medium"];
const params = new URLSearchParams(window.location.search);
// fxa will keep the most recent set of params until they are replaced
// by flushing them here
utms.forEach((type) => {
if (!params.has(`utm_${type}`)) {
params.append(`utm_${type}`, "fpn-default");
}
});
params.set("entrypoint", "fpn-site-visit");
params.set("form_type", "button");
return params;
}
// This adds flow information to the window. The click handler of the fxa
// subscription links will pick them up and add them to the query paramenters.
// This give funnel from the landing page to through the fxa lifecycle.
function setFxAFlowParams(data) {
window.fxaFlowParams = data;
}
// This sets up the FxA funnel for both the proxy and the VPN
// first we check storage to see if we've collected flow data
// in the last 31 days...If so, we pull it out of storate and
// and append params to fxa links for the vpn
// If we don't have these params, we go fetch them,
// then set them in storage and appen them to fxa links (if any)
// Using localstorage with a 31 day window lets the VPN fetch and use
// the fxa flow params using a content script
// here: https://github.com/mozilla/secure-proxy/blob/master/src/content/fetch-fxa-flow-params.js
async function initiateFxAMetrics() {
let flowInfo;
const store = window.localStorage;
const storedFlowInfo = store.getItem("flowInfo") || null;
// check if we have stored flow info in the last 31 days
// and just return if we have
if (storedFlowInfo !== null && storedFlowInfo !== "err") {
flowInfo = JSON.parse(storedFlowInfo);
const now = new Date();
const lastFetch = now.getTime() - flowInfo.flowBeginTime;
if (lastFetch < 31 * 24 * 60 * 60 * 1000) {
setFxAFlowParams(flowInfo);
return;
}
}
try {
const fxaMeta = document.querySelector("meta[name='fxa']");
const fxaUrl = fxaMeta && fxaMeta.content;
if (!fxaUrl) {
return;
}
const initialFlowParams = setFxAInitialParams();
const res = await fetch(`${fxaUrl}metrics-flow/?${initialFlowParams.toString()}`, {
mode: "cors",
});
flowInfo = await res.json();
setFxAFlowParams(flowInfo);
store.setItem("flowInfo", JSON.stringify(flowInfo));
} catch (err) {
// eslint-disable-next-line no-console
console.log(err);
store.setItem("flowInfo", "err");
}
}
function initiatePostHogAnalytics() {
const api = "phc_XQlc4j5RDhOh3WcsllRKJO8FGluXNQOrCYWLmBmH290" // put your own api key here
if (_dntEnabled()) {
return;
}
!(function (t, e) {
var o, n, p, r;
e.__SV ||
((window.posthog = e),
(e._i = []),
(e.init = function (i, s, a) {
function g(t, e) {
var o = e.split(".");
2 == o.length && ((t = t[o[0]]), (e = o[1])),
(t[e] = function () {
t.push([e].concat(Array.prototype.slice.call(arguments, 0)));
});
}
((p = t.createElement("script")).type = "text/javascript"),
(p.async = !0),
(p.src = s.api_host + "/static/array.js"),
(r = t.getElementsByTagName("script")[0]).parentNode.insertBefore(
p,
r
);
var u = e;
for (
void 0 !== a ? (u = e[a] = []) : (a = "posthog"),
u.people = u.people || [],
u.toString = function (t) {
var e = "posthog";
return "posthog" !== a && (e += "." + a), t || (e += " (stub)"), e;
},
u.people.toString = function () {
return u.toString(1) + ".people (stub)";
},
o =
"capture identify alias people.set people.set_once set_config register register_once unregister opt_out_capturing has_opted_out_capturing opt_in_capturing reset isFeatureEnabled onFeatureFlags".split(
" "
),
n = 0;
n < o.length;
n++
)
g(u, o[n]);
e._i.push([i, s, a]);
}),
(e.__SV = 1));
})(document, window.posthog || []);
window.posthog.init(api,{api_host:"https://app.posthog.com"})
}
</script>
<script>
(function () {
document.addEventListener("DOMContentLoaded", () => {
initiatePostHogAnalytics();
});
})();
</script>
</body>