File tree Expand file tree Collapse file tree 5 files changed +179
-16
lines changed
Expand file tree Collapse file tree 5 files changed +179
-16
lines changed Original file line number Diff line number Diff line change @@ -4,4 +4,6 @@ NUXT_PUBLIC_LOGIN_URL=
44
55# Analytics
66NUXT_PUBLIC_RUDDERSTACK_WRITE_KEY =
7- NUXT_PUBLIC_RUDDERSTACK_DATA_PLANE_URL =
7+ NUXT_PUBLIC_RUDDERSTACK_DATA_PLANE_URL =
8+ NUXT_POSTHOG_API_KEY =
9+ NUXT_POSTHOG_PROJECT_ID =
Original file line number Diff line number Diff line change 11import type { ApiObject , IdentifyTraits } from '@rudderstack/analytics-js'
22
33export function useAnalytics ( ) {
4- const { $rudderstack } = useNuxtApp ( )
4+ const { $rudderstack, $posthog } = useNuxtApp ( )
55
66 function track ( event : AnalyticsEvent , properties ?: ApiObject ) {
77 $rudderstack . track ( event , properties )
8+ $posthog ( ) . capture ( event , properties )
89 }
910
1011 function identify ( userId : string , traits ?: IdentifyTraits ) {
1112 $rudderstack . identify ( userId , traits )
13+ $posthog ( ) . identify ( userId , traits )
1214 }
1315
1416 function page ( ) {
@@ -17,6 +19,7 @@ export function useAnalytics() {
1719
1820 function reset ( ) {
1921 $rudderstack . reset ( )
22+ $posthog ( ) . reset ( )
2023 }
2124
2225 return {
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ export default defineNuxtConfig({
88 '@vueuse/nuxt' ,
99 '@nuxtjs/i18n' ,
1010 '@vite-pwa/nuxt' ,
11+ '@posthog/nuxt' ,
1112 ] ,
1213 devtools : { enabled : false } ,
1314 ssr : false ,
@@ -70,6 +71,9 @@ export default defineNuxtConfig({
7071 experimental : {
7172 typedPages : true ,
7273 } ,
74+ sourcemap : {
75+ client : 'hidden' ,
76+ } ,
7377 vite : {
7478 optimizeDeps : {
7579 include : [
@@ -268,6 +272,19 @@ export default defineNuxtConfig({
268272 } ,
269273 } ,
270274
275+ posthogConfig : {
276+ publicKey : 'phc_l88yVnYQJShvE2rFd1f7Cask76jMuK7qLVVyPlA9FLl' ,
277+ host : 'https://eu.i.posthog.com' ,
278+ clientConfig : {
279+ capture_exceptions : true ,
280+ } ,
281+ sourcemaps : {
282+ enabled : true ,
283+ personalApiKey : import . meta. env . NUXT_POSTHOG_API_KEY ,
284+ envId : import . meta. env . NUXT_POSTHOG_PROJECT_ID ,
285+ } ,
286+ } ,
287+
271288 colorMode : {
272289 preference : 'dark' ,
273290 fallback : 'dark' ,
Original file line number Diff line number Diff line change 2020 "@nuxt/image" : " ^2.0.0" ,
2121 "@nuxt/ui" : " ^4.2.1" ,
2222 "@nuxtjs/i18n" : " ^10.2.1" ,
23+ "@posthog/nuxt" : " ^1.3.15" ,
2324 "@rudderstack/analytics-js" : " ^3.26.0" ,
2425 "@tiptap/core" : " ^3.13.0" ,
2526 "@tiptap/markdown" : " ^3.13.0" ,
You can’t perform that action at this time.
0 commit comments