Посещаемость портала

This commit is contained in:
iriska-gri committed 2024-02-14 17:00:33 +03:00
1 parent 7c331fdb72
commit d70ab75ef1
3 files changed
+36 -24

No files matched your search

@@ -1,5 +1,5 @@
<template> <template>
<v-card class="text-center d-flex h-100 flex-column"> <v-card class="text-center text-blue-grey-darken-4 d-flex h-100 flex-column">
<v-tooltip width="250"> <v-tooltip width="250">
<template v-slot:activator="{ props }"> <template v-slot:activator="{ props }">
<v-icon <v-icon
@@ -15,18 +15,28 @@
</span> </span>
</v-tooltip> </v-tooltip>
<v-row no-gutters class="flex-grow-0 "> <v-row no-gutters class="flex-grow-0 ">
<v-col class="text-h5 "> <v-col class="text-h5 font-weight-bold">
{{indicator.title}} {{indicator.title}}
</v-col> </v-col>
</v-row> </v-row>
<v-row no-gutters class="flex-grow-0"> <v-row no-gutters class="flex-grow-0">
<v-col class="text-h5 font-weight-bold"> <v-col class="text-h6 font-weight-medium">
{{indicator.abb}} {{indicator.abb}}
</v-col> </v-col>
</v-row> </v-row>
<v-row no-gutters> <v-row no-gutters>
<v-col class="text-h2 text-center font-weight-medium align-self-center"> <v-col class="text-h3 text-cyan-darken-4 text-center font-weight-regular align-self-center">
{{indicator.data}}
<vue3-autocounter
ref='counter'
:startAmount='0'
:endAmount='indicator.data'
:duration='1'
:decimals="Number.isInteger(indicator.data)?0:2"
:suffix="indicator.abb=='(PPV)'?'':'%'"
/>
<!-- -->
</v-col> </v-col>
</v-row> </v-row>
</v-card> </v-card>
@@ -41,7 +51,7 @@ export default {
default: {} default: {}
}, },
} }
} }
</script> </script>
@@ -11,25 +11,25 @@
<v-card-text class="px-2"> <v-card-text class="px-2">
<v-table <v-table
fixed-header fixed-header
density="comfortable"
class="text-caption" class="text-caption table_traffic"
> >
<thead> <thead>
<tr > <tr >
<th></th> <th class="pr-0" ></th>
<th class="text-center">Уникальные пользователи</th> <th class="text-center px-1">Уникальные пользователи</th>
<th class="text-center">% от штата</th> <th class="text-center ">% от штата</th>
<th class="text-center">По сравнению предыдущим периодом</th> <th class="text-center">По сравнению предыдущим периодом</th>
</tr> </tr>
</thead> </thead>
<tbody class="text-h6"> <tbody class="text-button">
<tr v-for="(val, key) in traffic" :key = key> <tr v-for="(val, key) in traffic" :key = key>
<td></td> <!-- <td></td> -->
<!-- <td class="text-left font-weight-medium">{{val.title}}</td> --> <td style="white-space: nowrap" class="text-left text-caption pr-0 font-weight-medium">{{val.title}}</td>
<td class="text-center ">{{ val.user.length }} </td> <td class="text-center px-0">{{ val.user.length }} </td>
<td class="text-center"> <td class="text-center px-0">
{{ val.proc }}</td> {{ val.proc }}</td>
@@ -79,5 +79,8 @@ export default {
</script> </script>
<style> <style>
.v-table > .v-table__wrapper > table > tbody > tr > td
{
padding: 0 0 0px;
}
</style> </style>
+6 -7
View File
@@ -45,8 +45,7 @@ class Counter(ListAPIView):
crr_start = CountVisitor.objects.values('user', 'visitdate').filter(visitdate__lte = crrdate).distinct().count() crr_start = CountVisitor.objects.values('user', 'visitdate').filter(visitdate__lte = crrdate).distinct().count()
crr_end = CountVisitor.objects.values('user', 'visitdate').filter(visitdate__lte = request.GET.get("end")).distinct().count() crr_end = CountVisitor.objects.values('user', 'visitdate').filter(visitdate__lte = request.GET.get("end")).distinct().count()
crr_per = crr_end - crr_start crr_per = crr_end - crr_start
crr = ((crr_end - crr_per)/crr_start)*100
# BR # BR
br = perioddata.values_list('user', 'visitdate').order_by('user', 'visitdate').annotate(count_pages=Count('pages')).filter(count_pages=1).count() br = perioddata.values_list('user', 'visitdate').order_by('user', 'visitdate').annotate(count_pages=Count('pages')).filter(count_pages=1).count()
@@ -88,14 +87,14 @@ class Counter(ListAPIView):
'title': "Удержание", 'title': "Удержание",
'abb': "(CRR)", 'abb': "(CRR)",
'tooltip': "Показатель удержания клиентов (retention rate) — это коэффициент, который отражает способность компании выстраивать крепкие отношения с покупателями. Он показывает, насколько хорошо бизнес удерживает постоянных клиентов в течение определенного промежутка времени. Метрику также называют customer retention rate, или CRR.", 'tooltip': "Показатель удержания клиентов (retention rate) — это коэффициент, который отражает способность компании выстраивать крепкие отношения с покупателями. Он показывает, насколько хорошо бизнес удерживает постоянных клиентов в течение определенного промежутка времени. Метрику также называют customer retention rate, или CRR.",
'data': f"{toFixed(crr)}%" if is_integer(crr) == True else f"{round(crr, 2)}%", 'data': ((crr_end - crr_per)/crr_start)*100
}, },
'br': { 'br': {
'title': "Отказы", 'title': "Отказы",
'abb': "(BR)", 'abb': "(BR)",
'tooltip': "Термин в веб-аналитике, обозначающий процентное соотношение количества посетителей, покинувших сайт прямо со страницы входа или просмотревших не более одной страницы сайта", 'tooltip': "Термин в веб-аналитике, обозначающий процентное соотношение количества посетителей, покинувших сайт прямо со страницы входа или просмотревших не более одной страницы сайта",
'data': f"{toFixed((br/crr_per)*100)}%" if is_integer((br/crr_per)*100) == True else f"{round((br/crr_per)*100, 2)}%", 'data': (br/crr_per)*100,
}, },
@@ -103,15 +102,15 @@ class Counter(ListAPIView):
'title': "Страниц за визит", 'title': "Страниц за визит",
'abb': "(PPV)", 'abb': "(PPV)",
'tooltip': "Глубина просмотра страниц — поведенческая метрика, которая показывает, сколько страниц на сайте в среднем просматривает пользователь", 'tooltip': "Глубина просмотра страниц — поведенческая метрика, которая показывает, сколько страниц на сайте в среднем просматривает пользователь",
'data':round(ppv/crr_per, 0) 'data':ppv/crr_per
} }
} }
}) })
# 'data': f"{toFixed((br/crr_per)*100)}%" if is_integer((br/crr_per)*100) == True else f"{round((br/crr_per)*100, 2)}%",
# f"{toFixed(crr)}%" if is_integer(crr) == True else f"{round(crr, 2)}%",
def post(self, request): def post(self, request):
myfullPath = request.data['fullPath'] myfullPath = request.data['fullPath']
if "?" in myfullPath: if "?" in myfullPath: