MCPcopy Create free account
hub / github.com/Useful-Scripts-Extension/useful-script / trackEvent

Function trackEvent

scripts/helpers/utils.js:143–166  ·  view source on GitHub ↗
(scriptId)

Source from the content-addressed store, hash-verified

141}
142
143export async function trackEvent(scriptId) {
144 console.log("trackEvent", scriptId, version);
145 return;
146 try {
147 let res = await fetch(
148 // "http://localhost:3000/count",
149 "https://useful-script-statistic.glitch.me/count",
150 // "https://useful-script-statistic.onrender.com/count",
151 {
152 method: "POST",
153 headers: { "Content-Type": "application/json" },
154 body: JSON.stringify({
155 script: scriptId,
156 version: version,
157 uid: await getUserId(),
158 }),
159 }
160 );
161 return await res.text();
162 } catch (e) {
163 console.log("ERROR update script click count: ", e);
164 return null;
165 }
166}
167
168export async function sendEventToTab(tabId, data) {
169 console.log("... Sending ", data, " to tab...");

Callers 13

createTabsFunction · 0.90
createScriptButtonFunction · 0.90
checkIsPreviewFunction · 0.90
runScriptFunction · 0.90
initOpenInNewTabFunction · 0.90
initSettingsFunction · 0.90
backupFunction · 0.90
restoreFunction · 0.90
resetFunction · 0.90
initTrackingFunction · 0.90
index.jsFile · 0.90
checkForUpdateFunction · 0.90

Calls 1

getUserIdFunction · 0.85

Tested by

no test coverage detected