Created
February 26, 2019 19:54
-
-
Save dustinrecko/9f34969250f2e0668d4c4fe4808520a7 to your computer and use it in GitHub Desktop.
Set Google Analytics Client Id Cookie with Cloudflare Workers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
response.headers.append('Set-Cookie', `_ga=${["GA1", trackingDomain.split('.').length, crypto.getRandomValues(new Uint32Array(1))[0] & 2147483647, Math.round((new Date).getTime() / 1E3)].join(".")}; Domain=.${trackingDomain}; Max-Age=63072000;`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment