2022-08-02 09:24:17 +02:00
|
|
|
import { TELEMETRY_PIXEL } from 'lib/constants';
|
|
|
|
|
|
|
|
export default function handler(req, res) {
|
|
|
|
const { v } = req.query;
|
|
|
|
res.setHeader('content-type', 'text/javascript');
|
2022-08-02 09:32:28 +02:00
|
|
|
if (process.env.DISABLE_TELEMETRY) {
|
|
|
|
res.send('/* telemetry disabled */');
|
|
|
|
} else {
|
|
|
|
res.send(
|
|
|
|
`(() => {
|
2022-08-02 09:24:17 +02:00
|
|
|
const i = document.createElement('img');
|
|
|
|
i.setAttribute('src','${TELEMETRY_PIXEL}?v=${v}');
|
|
|
|
i.setAttribute('style','width:0;height:0;position:absolute;pointer-events:none;');
|
|
|
|
document.body.appendChild(i);
|
|
|
|
})();`,
|
2022-08-02 09:32:28 +02:00
|
|
|
);
|
|
|
|
}
|
2022-08-02 09:24:17 +02:00
|
|
|
}
|