Skip to content

Commit

Permalink
feat: track analytics with google analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
dlcastillop committed Mar 19, 2023
1 parent 740dee8 commit e512340
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 1 deletion.
12 changes: 12 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,18 @@
href="https://unpkg.com/boxicons@2.1.2/css/boxicons.min.css"
rel="stylesheet"
/>

<!-- Google tag (gtag.js) -->
<script async src=""></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag("js", new Date());

gtag("config", "G-DHNEV2JGR0");
</script>
</head>
<body data-theme="">
<div id="root"></div>
Expand Down
6 changes: 6 additions & 0 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ const App = () => {
// Set theme
document.body.setAttribute("data-theme", Config.theme);

const script = document.querySelectorAll("script")[2];
script.setAttribute(
"src",
"https://www.googletagmanager.com/gtag/js?id=" + Config.googleAnalyticsId
);

return (
<div className="max-w-xl mx-auto items-center justify-center min-h-screen">
<Modal qrData={qrData} />
Expand Down
4 changes: 3 additions & 1 deletion src/paylink.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,5 +135,7 @@
"value": "",
"img": "./images/payments/card.svg"
}
]
],

"googleAnalyticsId": "G-SOMEID"
}

0 comments on commit e512340

Please sign in to comment.