Skip to content

Commit b2f86fd

Browse files
committed
refactor: gtag
Signed-off-by: Adam Setch <[email protected]>
1 parent 1d34119 commit b2f86fd

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed
Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
---
2+
import { siteMetadata } from '../constants.ts';
3+
4+
const GTAG_ID = siteMetadata.google.gtag;
5+
const GTAG_SRC = `https://www.googletagmanager.com/gtag/js?id=${GTAG_ID}`;
6+
---
17
<!-- Google tag (gtag.js) -->
2-
<script
3-
async
4-
src="https://www.googletagmanager.com/gtag/js?id=G-736BKHY5WS"
5-
></script>
8+
<script async src={GTAG_SRC}></script>
69
<script>
710
window.dataLayer = window.dataLayer || [];
811
function gtag() {
@@ -11,5 +14,5 @@ function gtag() {
1114
}
1215
gtag('js', new Date());
1316

14-
gtag('config', 'G-736BKHY5WS');
17+
gtag('config', GTAG_ID);
1518
</script>

src/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export const siteMetadata = {
1313
site: 'https://setchy.io',
1414
},
1515
google: {
16+
gtag: 'G-736BKHY5WS',
1617
siteVerification: '',
1718
},
1819
menuLinks: [

0 commit comments

Comments
 (0)