Skip to content

Commit

Permalink
feat: add apple wallet page action
Browse files Browse the repository at this point in the history
  • Loading branch information
qin-guan committed Feb 3, 2024
1 parent ee5db9c commit da0131c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
10 changes: 9 additions & 1 deletion pages/pass/[admissionKey].vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { useQRCode } from '@vueuse/integrations/useQRCode'
Framework7.use(Framework7Vue)
const app = useNuxtApp()
const route = useRoute()
const { data: admission, isLoading: admissionIsLoading, error } = useAdmission(route.params.admissionKey as string)
const { data: admissionPkPass } = useAdmissionPkPass(route.params.admissionKey as string)
Expand All @@ -29,6 +30,13 @@ const qrcode = useQRCode(() => admission.value?.admissionKey ?? '', {
useSeoMeta({
title: admission.value?.event.name ?? 'SSTAA Pass',
})
function reportEvent() {
app.$newrelic.addPageAction('add-to-apple-wallet-clicked', {
eventId: admission.value?.eventId,
admissionKey: admission.value?.admissionKey,
})
}
</script>

<template>
Expand Down Expand Up @@ -105,7 +113,7 @@ useSeoMeta({

<br>

<a v-if="admissionPkPass" :href="`/cdn/apple-wallet/${admission.eventId}/${route.params.admissionKey}.pkpass`" target="_blank" class="external cursor-pointer">
<a v-if="admissionPkPass" :href="`/cdn/apple-wallet/${admission.eventId}/${route.params.admissionKey}.pkpass`" target="_blank" class="external cursor-pointer" @click="reportEvent">
<img
src="~/assets/pass/add-to-apple-wallet.svg"
alt="Add to Apple Wallet"
Expand Down
8 changes: 7 additions & 1 deletion plugins/new-relic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,11 @@ export default defineNuxtPlugin(() => {
loader_config: { accountID: '4337277', trustKey: '4337277', agentID: config.newRelic.agentId, licenseKey: 'NRJS-1b1f41c1d6baafe183c', applicationID: config.newRelic.applicationId },
}

const _ = new BrowserAgent(options)
const newrelic = new BrowserAgent(options)

return {
provide: {
newrelic,
},
}
})

0 comments on commit da0131c

Please sign in to comment.