Skip to content

Commit

Permalink
Add GA tags
Browse files Browse the repository at this point in the history
  • Loading branch information
TimDaub committed Sep 1, 2023
1 parent 8227c79 commit 5ddc950
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/public/ga.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,16 @@ function gtag() {
}
gtag("js", new Date());

gtag("config", "G-21BKTD0NKN");
const key = "G-21BKTD0NKN";
gtag("config", key);

const isPWA = window.matchMedia("(display-mode: standalone)").matches;
gtag("config", key, {
pwa_mode: isPWA ? "Standalone" : "Not Standalone",
});

const schema = /^-kiwi-news-(0x[a-fA-F0-9]{40})-key$/;
const usesDelegation = Object.keys(localStorage).some(key => schema.test(key));
gtag("config", key, {
uses_delegation: usesDelegations ? "Delegation" : "Wallet Connection",
});

0 comments on commit 5ddc950

Please sign in to comment.