(scriptId)
| 141 | } |
| 142 | |
| 143 | export 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 | |
| 168 | export async function sendEventToTab(tabId, data) { |
| 169 | console.log("... Sending ", data, " to tab..."); |
no test coverage detected