mirror of
https://github.com/ThatGuySam/doesitarm.git
synced 2026-05-15 06:35:20 -07:00
Add ua experimenetal code
This commit is contained in:
parent
e307451d40
commit
fc425a3fe7
1 changed files with 6 additions and 0 deletions
|
|
@ -8,6 +8,9 @@
|
|||
// event.respondWith(gaHandleRequest(event.request, event))
|
||||
// });
|
||||
|
||||
// TODO: Try rebuilding this library as local ESM
|
||||
// https://github.com/peaksandpies/universal-analytics
|
||||
// import ua from 'universal-analytics'
|
||||
|
||||
addEventListener('fetch', event => {
|
||||
event.respondWith(handleRequest(event.request))
|
||||
|
|
@ -16,8 +19,11 @@ addEventListener('fetch', event => {
|
|||
|
||||
// Alter Headers - https://developers.cloudflare.com/workers/examples/alter-headers
|
||||
async function handleRequest(request) {
|
||||
// const visitor = ua( process.env.GA_TRACKING_ID )
|
||||
|
||||
const response = await fetch(request)
|
||||
|
||||
|
||||
// Clone the response so that it's no longer immutable
|
||||
const newResponse = new Response(response.body, response)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue