feat: Refinamiento del tracking de analiticas y actualizacion del dashboard admin
This commit is contained in:
@ -15,6 +15,7 @@
|
||||
import { ref, computed, watch } from 'vue'
|
||||
import { useFavoritesStore } from '@/stores/favorites'
|
||||
import { useAuthStore } from '@/stores/auth'
|
||||
import { analyticsService } from '@/services/analyticsService'
|
||||
|
||||
const props = defineProps<{
|
||||
itemType: 'coupon' | 'business' | 'taxi' | 'route' | 'stop' | 'shuttle'
|
||||
@ -59,6 +60,15 @@ async function handleToggle() {
|
||||
props.itemName,
|
||||
props.itemImage
|
||||
)
|
||||
|
||||
const isNowFavorited = favoritesStore.isFavorite(props.itemType, props.itemId)
|
||||
const entityTypeMap: Record<string, any> = { business: 'business', shuttle: 'shuttle', coupon: 'coupon', stop: 'stop', route: 'route' }
|
||||
analyticsService.logEvent({
|
||||
event_name: isNowFavorited ? 'favorite_add' : 'favorite_remove',
|
||||
entity_type: entityTypeMap[props.itemType] || 'other',
|
||||
entity_id: props.itemId,
|
||||
entity_name: props.itemName || 'item'
|
||||
})
|
||||
} catch (error) {
|
||||
console.error('Error toggling favorite:', error)
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user