Отрисовка параметров
This commit is contained in:
1 parent
92b3461f05
commit
7c331fdb72
3 files changed
+19
-12
No files matched your search
@@ -1,9 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<v-card
|
<v-card class="text-center d-flex h-100 flex-column">
|
||||||
|
|
||||||
class="text-center 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
|
||||||
@@ -28,24 +24,24 @@
|
|||||||
{{indicator.abb}}
|
{{indicator.abb}}
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
<v-row no-gutters class="">
|
<v-row no-gutters>
|
||||||
|
|
||||||
<v-col class="text-h2 text-center font-weight-medium align-self-center">
|
<v-col class="text-h2 text-center font-weight-medium align-self-center">
|
||||||
{{indicator.data}}
|
{{indicator.data}}
|
||||||
</v-col>
|
</v-col>
|
||||||
</v-row>
|
</v-row>
|
||||||
|
|
||||||
</v-card>
|
</v-card>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
props: {
|
props: {
|
||||||
indicator: {
|
indicator: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: {}
|
default: {}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<tr >
|
<tr >
|
||||||
<th></th>
|
<th></th>
|
||||||
<th class="text-center">Уникальные пользователи</th>
|
<th class="text-center">Уникальные пользователи</th>
|
||||||
<th class="text-center">% от шага</th>
|
<th class="text-center">% от штата</th>
|
||||||
<th class="text-center">По сравнению предыдущим периодом</th>
|
<th class="text-center">По сравнению предыдущим периодом</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|||||||
+14
-3
@@ -18,7 +18,14 @@ class Counter(ListAPIView):
|
|||||||
permission_classes = (AllowAny,)
|
permission_classes = (AllowAny,)
|
||||||
serializer_class = CountSerializer
|
serializer_class = CountSerializer
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def get(self, request):
|
def get(self, request):
|
||||||
|
def is_integer(x):
|
||||||
|
return x % 1 ==0
|
||||||
|
|
||||||
|
def toFixed(numObj, digits=0):
|
||||||
|
return f"{numObj:.{digits}f}"
|
||||||
|
|
||||||
perioddata = CountVisitor.objects.filter(visitdate__range=[request.GET.get("start"), request.GET.get("end")])
|
perioddata = CountVisitor.objects.filter(visitdate__range=[request.GET.get("start"), request.GET.get("end")])
|
||||||
|
|
||||||
@@ -38,6 +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()
|
||||||
@@ -80,27 +88,30 @@ class Counter(ListAPIView):
|
|||||||
'title': "Удержание",
|
'title': "Удержание",
|
||||||
'abb': "(CRR)",
|
'abb': "(CRR)",
|
||||||
'tooltip': "Показатель удержания клиентов (retention rate) — это коэффициент, который отражает способность компании выстраивать крепкие отношения с покупателями. Он показывает, насколько хорошо бизнес удерживает постоянных клиентов в течение определенного промежутка времени. Метрику также называют customer retention rate, или CRR.",
|
'tooltip': "Показатель удержания клиентов (retention rate) — это коэффициент, который отражает способность компании выстраивать крепкие отношения с покупателями. Он показывает, насколько хорошо бизнес удерживает постоянных клиентов в течение определенного промежутка времени. Метрику также называют customer retention rate, или CRR.",
|
||||||
'data':round(((crr_end - crr_per)/crr_start)*100, 2),
|
'data': f"{toFixed(crr)}%" if is_integer(crr) == True else f"{round(crr, 2)}%",
|
||||||
},
|
},
|
||||||
|
|
||||||
'br': {
|
'br': {
|
||||||
'title': "Отказы",
|
'title': "Отказы",
|
||||||
'abb': "(BR)",
|
'abb': "(BR)",
|
||||||
'tooltip': "Термин в веб-аналитике, обозначающий процентное соотношение количества посетителей, покинувших сайт прямо со страницы входа или просмотревших не более одной страницы сайта",
|
'tooltip': "Термин в веб-аналитике, обозначающий процентное соотношение количества посетителей, покинувших сайт прямо со страницы входа или просмотревших не более одной страницы сайта",
|
||||||
'data': round((br/crr_per)*100, 2),
|
'data': f"{toFixed((br/crr_per)*100)}%" if is_integer((br/crr_per)*100) == True else f"{round((br/crr_per)*100, 2)}%",
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
'ppv': {
|
'ppv': {
|
||||||
'title': "Страниц за визит",
|
'title': "Страниц за визит",
|
||||||
'abb': "(PPV)",
|
'abb': "(PPV)",
|
||||||
'tooltip': "Глубина просмотра страниц — поведенческая метрика, которая показывает, сколько страниц на сайте в среднем просматривает пользователь",
|
'tooltip': "Глубина просмотра страниц — поведенческая метрика, которая показывает, сколько страниц на сайте в среднем просматривает пользователь",
|
||||||
'data':round(ppv/crr_per, 2)
|
'data':round(ppv/crr_per, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def post(self, request):
|
def post(self, request):
|
||||||
myfullPath = request.data['fullPath']
|
myfullPath = request.data['fullPath']
|
||||||
if "?" in myfullPath:
|
if "?" in myfullPath:
|
||||||
|
|||||||
Reference in new issue
Block a user