Skip to content

Commit 8d7aa4a

Browse files
authored
Merge pull request #203 from pkgxdev/add-gtag
add google analytics to pkgx.dev
2 parents 6020495 + f2b4a2d commit 8d7aa4a

1 file changed

Lines changed: 12 additions & 2 deletions

File tree

vite.config.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ function description() {
6060
function scripts() {
6161
switch (process.env.VITE_HOST) {
6262
case 'pkgx.dev':
63-
return `<script>
63+
return `<!-- meta pixel -->
64+
<script>
6465
!function (f, b, e, v, n, t, s) {
6566
if (f.fbq) return; n = f.fbq = function () {
6667
n.callMethod ?
@@ -78,7 +79,16 @@ function scripts() {
7879
<noscript>
7980
<img height="1" width="1" style="display:none"
8081
src="https://www.facebook.com/tr?id=1632217704843931&ev=PageView&noscript=1" />
81-
</noscript>`;
82+
</noscript>
83+
<!-- Google tag (gtag.js) -->
84+
<script async src="https://www.googletagmanager.com/gtag/js?id=G-FHTCBX27VL"></script>
85+
<script>
86+
window.dataLayer = window.dataLayer || [];
87+
function gtag(){dataLayer.push(arguments);}
88+
gtag('js', new Date());
89+
90+
gtag('config', 'G-FHTCBX27VL');
91+
</script>`;
8292
default: return '';
8393
}
8494
}

0 commit comments

Comments
 (0)