mirror of
				https://github.com/CorentinTh/it-tools.git
				synced 2025-11-03 18:37:00 -05:00 
			
		
		
		
	feat(tracker): added actions monitoring
This commit is contained in:
		
							parent
							
								
									40872859a5
								
							
						
					
					
						commit
						bfc2e24bbf
					
				@ -61,6 +61,7 @@ function renderOption({ tool }: { tool: Tool }) {
 | 
				
			|||||||
      :render-label="renderOption"
 | 
					      :render-label="renderOption"
 | 
				
			||||||
      :default-value="'aa'"
 | 
					      :default-value="'aa'"
 | 
				
			||||||
      :get-show="() => true"
 | 
					      :get-show="() => true"
 | 
				
			||||||
 | 
					      :on-focus="() => $tracker.trackEvent({ eventName: 'Search-bar focused' })"
 | 
				
			||||||
    >
 | 
					    >
 | 
				
			||||||
      <template #default="{ handleInput, handleBlur, handleFocus, value: slotValue }">
 | 
					      <template #default="{ handleInput, handleBlur, handleFocus, value: slotValue }">
 | 
				
			||||||
        <n-input
 | 
					        <n-input
 | 
				
			||||||
 | 
				
			|||||||
@ -157,6 +157,7 @@ const menuOptions = computed<MenuGroupOption[]>(() =>
 | 
				
			|||||||
              target="_blank"
 | 
					              target="_blank"
 | 
				
			||||||
              class="support-button"
 | 
					              class="support-button"
 | 
				
			||||||
              :bordered="false"
 | 
					              :bordered="false"
 | 
				
			||||||
 | 
					              @click="() => $tracker.trackEvent({ eventName: 'Support button clicked' })"
 | 
				
			||||||
            >
 | 
					            >
 | 
				
			||||||
              Buy me a coffee
 | 
					              Buy me a coffee
 | 
				
			||||||
              <n-icon v-if="!styleStore.isSmallScreen" :component="Heart" style="margin-left: 5px" />
 | 
					              <n-icon v-if="!styleStore.isSmallScreen" :component="Heart" style="margin-left: 5px" />
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										11
									
								
								src/modules/tracker/tracker.services.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								src/modules/tracker/tracker.services.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,11 @@
 | 
				
			|||||||
 | 
					import type Plausible from 'plausible-tracker';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export { createTrackerService };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					function createTrackerService({ plausible }: { plausible: ReturnType<typeof Plausible> }) {
 | 
				
			||||||
 | 
					  return {
 | 
				
			||||||
 | 
					    trackEvent({ eventName }: { eventName: string }) {
 | 
				
			||||||
 | 
					      plausible.trackEvent(eventName);
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
 | 
					  };
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
							
								
								
									
										3
									
								
								src/modules/tracker/tracker.types.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										3
									
								
								src/modules/tracker/tracker.types.ts
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,3 @@
 | 
				
			|||||||
 | 
					import type { createTrackerService } from './tracker.services';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export type TrackerService = ReturnType<typeof createTrackerService>;
 | 
				
			||||||
@ -25,6 +25,7 @@ useHead({ title: 'About - IT Tools' });
 | 
				
			|||||||
        href="https://github.com/sponsors/CorentinTh"
 | 
					        href="https://github.com/sponsors/CorentinTh"
 | 
				
			||||||
        rel="noopener"
 | 
					        rel="noopener"
 | 
				
			||||||
        target="_blank"
 | 
					        target="_blank"
 | 
				
			||||||
 | 
					        @click="() => $tracker.trackEvent({ eventName: 'Support button clicked' })"
 | 
				
			||||||
      >
 | 
					      >
 | 
				
			||||||
        sponsoring me </n-button
 | 
					        sponsoring me </n-button
 | 
				
			||||||
      >.
 | 
					      >.
 | 
				
			||||||
 | 
				
			|||||||
@ -1,4 +1,5 @@
 | 
				
			|||||||
import { config } from '@/config';
 | 
					import { config } from '@/config';
 | 
				
			||||||
 | 
					import { createTrackerService } from '@/modules/tracker/tracker.services';
 | 
				
			||||||
import Plausible from 'plausible-tracker';
 | 
					import Plausible from 'plausible-tracker';
 | 
				
			||||||
import type { App } from 'vue';
 | 
					import type { App } from 'vue';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -7,6 +8,6 @@ export const plausible = {
 | 
				
			|||||||
    const plausible = Plausible(config.plausible);
 | 
					    const plausible = Plausible(config.plausible);
 | 
				
			||||||
    plausible.enableAutoPageviews();
 | 
					    plausible.enableAutoPageviews();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    app.config.globalProperties.$plausible = plausible;
 | 
					    app.config.globalProperties.$tracker = createTrackerService({ plausible });
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										7
									
								
								src/shims.d.ts
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										7
									
								
								src/shims.d.ts
									
									
									
									
										vendored
									
									
								
							@ -1,3 +1,10 @@
 | 
				
			|||||||
 | 
					import type { TrackerService } from './modules/tracker/tracker.types';
 | 
				
			||||||
 | 
					declare module 'vue' {
 | 
				
			||||||
 | 
					  interface ComponentCustomProperties {
 | 
				
			||||||
 | 
					    $tracker: TrackerService;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
declare module '*.vue' {
 | 
					declare module '*.vue' {
 | 
				
			||||||
  import type { ComponentOptions, ComponentOptions } from 'vue';
 | 
					  import type { ComponentOptions, ComponentOptions } from 'vue';
 | 
				
			||||||
  const Component: ComponentOptions;
 | 
					  const Component: ComponentOptions;
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user