Skip to content

Commit

Permalink
feat: add gtag track events
Browse files Browse the repository at this point in the history
  • Loading branch information
imrim12 committed Nov 24, 2024
1 parent f05bf55 commit bc18130
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 11 deletions.
3 changes: 3 additions & 0 deletions app/app.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ initConfigStore()
const configStore = useConfigStore()
const { initialize: initializeHotJar } = useHotjar()
const { isMobile } = useDevice()
const { global } = useTheme()
Expand All @@ -29,6 +30,8 @@ onBeforeMount(async () => {
// notify(payload.notification?.body as string, { type: 'primary', link: `/projects/${linkSplits![1]}` })
})
}
initializeHotJar()
})
</script>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ async function handleOpenStripePortal() {
body: t('You will be redirected to the Stripe portal to manage your subscription!'),
})
useTrackEvent('subscription:portal')
if (import.meta.env.STRIPE_CUSTOMER_PORTAL_URL)
window.location.href = import.meta.env.STRIPE_CUSTOMER_PORTAL_URL
else
Expand Down
2 changes: 2 additions & 0 deletions app/pages/auth/confirmation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ async function resendConfirmation() {
notifySuccess({
content: t('Another confirmation email has been sent to your email address!'),
})
useTrackEvent('auth:confirmation')
}
catch {
notifyError({
Expand Down
2 changes: 2 additions & 0 deletions app/pages/auth/forgot-password.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ async function sendResetLink() {
content: t('An email has been sent to your email address with instructions to reset your password!'),
})
useTrackEvent('auth:forgot-password')
navigateTo('/auth/login')
}
catch (error: any) {
Expand Down
4 changes: 4 additions & 0 deletions app/pages/auth/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ async function login(provider?: string) {
try {
loading()
useTrackEvent('auth:login', {
method: provider
})
if (provider) {
await signIn(provider, {
callbackUrl: withQuery(route.query.to ? String(route.query.to) : '/', { loggedIn: true }),
Expand Down
4 changes: 4 additions & 0 deletions app/pages/auth/register.vue
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ async function login(provider?: string) {
try {
loading()
useTrackEvent('auth:signup', {
method: provider
})
if (provider) {
await signIn(provider, { callbackUrl: '/' })
}
Expand Down
2 changes: 2 additions & 0 deletions app/pages/auth/reset-password.vue
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ async function resetPassword() {
})
navigateTo('/auth/login')
useTrackEvent('auth:reset-password')
}
catch (error: any) {
notifyError({ content: error.message })
Expand Down
2 changes: 2 additions & 0 deletions app/pages/auth/verify.vue
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ async function handleVerify() {
})
navigateTo(redirectTo.value)
useTrackEvent('auth:verify')
}
catch (error: any) {
notifyError({
Expand Down
9 changes: 9 additions & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ export default defineNuxtConfig({
'@pinia/nuxt',
'nuxt-vuefire',
'nuxt-gtag',
'nuxt-module-hotjar',
'nuxt-nodemailer',
],

Expand All @@ -275,6 +276,14 @@ export default defineNuxtConfig({
],
},

hotjar: {
hotjarId: process.env.HOTJAR_ID,
scriptVersion: 6,

// optionally you can turn on debug mode for development
debug: process.env.NODE_ENV === 'development',
},

nodemailer: process.env.NODE_ENV === 'development'
? {
from: process.env.SMTP_FROM,
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@
"nodemailer": "^6.9.15",
"nuxt": "^3.13.2",
"nuxt-gtag": "^3.0.2",
"nuxt-module-hotjar": "^1.3.2",
"nuxt-nodemailer": "^1.1.2",
"nuxt-vuefire": "^1.0.3",
"ofetch": "1.3.4",
Expand Down
44 changes: 33 additions & 11 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bc18130

Please sign in to comment.