index.html.twig 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444
  1. {% extends 'admin/base.html.twig' %}
  2. {% block content %}
  3. <div class="content">
  4. <div class="container-fluid">
  5. <div class="row">
  6. <div class="col-md-12">
  7. <div class="card">
  8. <div class="card-header">
  9. <div class="float-left">
  10. <h4 class="card-title">Количество уникальных пользователей (по дням)</h4>
  11. </div>
  12. </div>
  13. <div class="card-body">
  14. <canvas id="usersDay" height="300"></canvas>
  15. </div>
  16. </div>
  17. </div>
  18. </div>
  19. <div class="row">
  20. <div class="col-md-12">
  21. <div class="card">
  22. <div class="card-header">
  23. <div class="float-left">
  24. <h4 class="card-title">Количество новых пользователей (по дням)</h4>
  25. </div>
  26. </div>
  27. <div class="card-body">
  28. <canvas id="newUsersDay" height="300"></canvas>
  29. </div>
  30. </div>
  31. </div>
  32. </div>
  33. <div class="row">
  34. <div class="col-md-12">
  35. <div class="card">
  36. <div class="card-header">
  37. <div class="float-left">
  38. <h4 class="card-title">Количество просмотренных страниц (по дням)</h4>
  39. </div>
  40. </div>
  41. <div class="card-body">
  42. <canvas id="hitsDay" height="300"></canvas>
  43. </div>
  44. </div>
  45. </div>
  46. </div>
  47. <div class="row">
  48. <div class="col-md-12">
  49. <div class="card">
  50. <div class="card-header">
  51. <div class="float-left">
  52. <h4 class="card-title">Количество сессий (по дням)</h4>
  53. </div>
  54. </div>
  55. <div class="card-body">
  56. <canvas id="sessionsDay" height="300"></canvas>
  57. </div>
  58. </div>
  59. </div>
  60. </div>
  61. <div class="row">
  62. <div class="col-md-12">
  63. <div class="card">
  64. <div class="card-header">
  65. <div class="float-left">
  66. <h4 class="card-title">Средняя длительность сессии в минутах (по дням)</h4>
  67. </div>
  68. </div>
  69. <div class="card-body">
  70. <canvas id="avgSessionDurationDay" height="300"></canvas>
  71. </div>
  72. </div>
  73. </div>
  74. </div>
  75. <div class="row">
  76. <div class="col-md-12">
  77. <div class="card">
  78. <div class="card-header">
  79. <div class="float-left">
  80. <h4 class="card-title">Показатель отказов в % (по дням)</h4>
  81. </div>
  82. </div>
  83. <div class="card-body">
  84. <canvas id="bounceRateDay" height="300"></canvas>
  85. </div>
  86. </div>
  87. </div>
  88. </div>
  89. <div class="row">
  90. <div class="col-md-12">
  91. <div class="card">
  92. <div class="card-header">
  93. <div class="float-left">
  94. <h4 class="card-title">Количество уникальных пользователей (по неделям)</h4>
  95. </div>
  96. </div>
  97. <div class="card-body">
  98. <canvas id="usersWeek" height="300"></canvas>
  99. </div>
  100. </div>
  101. </div>
  102. </div>
  103. <div class="row">
  104. <div class="col-md-12">
  105. <div class="card">
  106. <div class="card-header">
  107. <div class="float-left">
  108. <h4 class="card-title">Количество новых пользователей (по неделям)</h4>
  109. </div>
  110. </div>
  111. <div class="card-body">
  112. <canvas id="newUsersWeek" height="300"></canvas>
  113. </div>
  114. </div>
  115. </div>
  116. </div>
  117. <div class="row">
  118. <div class="col-md-12">
  119. <div class="card">
  120. <div class="card-header">
  121. <div class="float-left">
  122. <h4 class="card-title">Количество просмотренных страниц (по неделям)</h4>
  123. </div>
  124. </div>
  125. <div class="card-body">
  126. <canvas id="hitsWeek" height="300"></canvas>
  127. </div>
  128. </div>
  129. </div>
  130. </div>
  131. <div class="row">
  132. <div class="col-md-12">
  133. <div class="card">
  134. <div class="card-header">
  135. <div class="float-left">
  136. <h4 class="card-title">Количество сессий (по неделям)</h4>
  137. </div>
  138. </div>
  139. <div class="card-body">
  140. <canvas id="sessionsWeek" height="300"></canvas>
  141. </div>
  142. </div>
  143. </div>
  144. </div>
  145. <div class="row">
  146. <div class="col-md-12">
  147. <div class="card">
  148. <div class="card-header">
  149. <div class="float-left">
  150. <h4 class="card-title">Средняя длительность сессии в минутах (по неделям)</h4>
  151. </div>
  152. </div>
  153. <div class="card-body">
  154. <canvas id="avgSessionDurationWeek" height="300"></canvas>
  155. </div>
  156. </div>
  157. </div>
  158. </div>
  159. <div class="row">
  160. <div class="col-md-12">
  161. <div class="card">
  162. <div class="card-header">
  163. <div class="float-left">
  164. <h4 class="card-title">Показатель отказов в % (по неделям)</h4>
  165. </div>
  166. </div>
  167. <div class="card-body">
  168. <canvas id="bounceRateWeek" height="300"></canvas>
  169. </div>
  170. </div>
  171. </div>
  172. </div>
  173. </div>
  174. </div>
  175. {% endblock %}
  176. {% block admin_js_body %}
  177. {{ parent() }}
  178. <script src="{{ asset('static/admin/src/chart/Chart.min.js') }}"></script>
  179. <script>
  180. function getOptions(max) {
  181. return {
  182. responsive: true,
  183. maintainAspectRatio: false,
  184. legend: { display: false },
  185. scales: {
  186. yAxes: [{
  187. ticks: { beginAtZero: true, min: 0, suggestedMax: max }
  188. }]
  189. },
  190. tooltips: {
  191. displayColors: false,
  192. callbacks: {
  193. title: function(tooltipItem, data) {
  194. return '';
  195. },
  196. label: function(tooltipItem, data) {
  197. return tooltipItem.yLabel.toString();
  198. }
  199. }
  200. }
  201. };
  202. }
  203. {% if statistics['day']['users'] is defined %}
  204. const usersDayContext = document.getElementById('usersDay').getContext('2d');
  205. const usersDayChart = new Chart(usersDayContext, {
  206. type: 'line',
  207. data: {
  208. labels: [{{ statistics['day']['users']['labels']|map((elem) => "'#{elem}'")|join(',')|raw }}],
  209. datasets: [{
  210. label: '',
  211. data: [{{ statistics['day']['users']['values']|join(',') }}],
  212. backgroundColor: ['rgba(58, 235, 137, 0.2)'],
  213. borderColor: ['rgba(58, 235, 137, 1)'],
  214. borderWidth: 2
  215. }]
  216. },
  217. options: getOptions({{ max(statistics['day']['users']['values']) }})
  218. });
  219. {% endif %}
  220. {% if statistics['day']['newUsers'] is defined %}
  221. const newUsersDayContext = document.getElementById('newUsersDay').getContext('2d');
  222. const newUsersDayChart = new Chart(newUsersDayContext, {
  223. type: 'line',
  224. data: {
  225. labels: [{{ statistics['day']['newUsers']['labels']|map((elem) => "'#{elem}'")|join(',')|raw }}],
  226. datasets: [{
  227. label: '',
  228. data: [{{ statistics['day']['newUsers']['values']|join(',') }}],
  229. backgroundColor: ['rgba(219, 220, 85, 0.2)'],
  230. borderColor: ['rgba(219, 220, 85, 1)'],
  231. borderWidth: 2
  232. }]
  233. },
  234. options: getOptions({{ max(statistics['day']['newUsers']['values']) }})
  235. });
  236. {% endif %}
  237. {% if statistics['day']['hits'] is defined %}
  238. const hitsDayContext = document.getElementById('hitsDay').getContext('2d');
  239. const hitsDayChart = new Chart(hitsDayContext, {
  240. type: 'line',
  241. data: {
  242. labels: [{{ statistics['day']['hits']['labels']|map((elem) => "'#{elem}'")|join(',')|raw }}],
  243. datasets: [{
  244. label: '',
  245. data: [{{ statistics['day']['hits']['values']|join(',') }}],
  246. backgroundColor: [ 'rgba(54, 162, 235, 0.2)' ],
  247. borderColor: [ 'rgba(54, 162, 235, 1)' ],
  248. borderWidth: 2
  249. }]
  250. },
  251. options: getOptions({{ max(statistics['day']['hits']['values']) }})
  252. });
  253. {% endif %}
  254. {% if statistics['day']['sessions'] is defined %}
  255. const sessionsDayContext = document.getElementById('sessionsDay').getContext('2d');
  256. const sessionsDayChart = new Chart(sessionsDayContext, {
  257. type: 'line',
  258. data: {
  259. labels: [{{ statistics['day']['sessions']['labels']|map((elem) => "'#{elem}'")|join(',')|raw }}],
  260. datasets: [{
  261. label: '',
  262. data: [{{ statistics['day']['sessions']['values']|join(',') }}],
  263. backgroundColor: [ 'rgba(188, 62, 236, 0.2)' ],
  264. borderColor: [ 'rgba(188, 62, 236, 1)' ],
  265. borderWidth: 2
  266. }]
  267. },
  268. options: getOptions({{ max(statistics['day']['sessions']['values']) }})
  269. });
  270. {% endif %}
  271. {% if statistics['day']['avgSessionDuration'] is defined %}
  272. const avgSessionDurationDayContext = document.getElementById('avgSessionDurationDay').getContext('2d');
  273. const avgSessionDurationDayChart = new Chart(avgSessionDurationDayContext, {
  274. type: 'line',
  275. data: {
  276. labels: [{{ statistics['day']['avgSessionDuration']['labels']|map((elem) => "'#{elem}'")|join(',')|raw }}],
  277. datasets: [{
  278. label: '',
  279. data: [{{ statistics['day']['avgSessionDuration']['values']|join(',') }}],
  280. backgroundColor: [ 'rgba(131, 235, 58, 0.2)' ],
  281. borderColor: [ 'rgba(131, 235, 58, 1)' ],
  282. borderWidth: 2
  283. }]
  284. },
  285. options: getOptions({{ max(statistics['day']['avgSessionDuration']['values']) }})
  286. });
  287. {% endif %}
  288. {% if statistics['day']['bounceRate'] is defined %}
  289. const bounceRateDayContext = document.getElementById('bounceRateDay').getContext('2d');
  290. const bounceRateDayChart = new Chart(bounceRateDayContext, {
  291. type: 'line',
  292. data: {
  293. labels: [{{ statistics['day']['bounceRate']['labels']|map((elem) => "'#{elem}'")|join(',')|raw }}],
  294. datasets: [{
  295. label: '',
  296. data: [{{ statistics['day']['bounceRate']['values']|join(',') }}],
  297. backgroundColor: [ 'rgba(237, 67, 64, 0.1)' ],
  298. borderColor: [ 'rgba(237, 67, 64, 0.8)' ],
  299. borderWidth: 2
  300. }]
  301. },
  302. options: getOptions({{ max(statistics['day']['bounceRate']['values']) }})
  303. });
  304. {% endif %}
  305. {% if statistics['week']['users'] is defined %}
  306. const usersWeekContext = document.getElementById('usersWeek').getContext('2d');
  307. const usersWeekChart = new Chart(usersWeekContext, {
  308. type: 'line',
  309. data: {
  310. labels: [{{ statistics['week']['users']['labels']|map((elem) => "'#{elem}'")|join(',')|raw }}],
  311. datasets: [{
  312. label: '',
  313. data: [{{ statistics['week']['users']['values']|join(',') }}],
  314. backgroundColor: ['rgba(58, 235, 137, 0.2)'],
  315. borderColor: ['rgba(58, 235, 137, 1)'],
  316. borderWidth: 2
  317. }]
  318. },
  319. options: getOptions({{ max(statistics['week']['users']['values']) }})
  320. });
  321. {% endif %}
  322. {% if statistics['week']['newUsers'] is defined %}
  323. const newUsersWeekContext = document.getElementById('newUsersWeek').getContext('2d');
  324. const newUsersWeekChart = new Chart(newUsersWeekContext, {
  325. type: 'line',
  326. data: {
  327. labels: [{{ statistics['week']['newUsers']['labels']|map((elem) => "'#{elem}'")|join(',')|raw }}],
  328. datasets: [{
  329. label: '',
  330. data: [{{ statistics['week']['newUsers']['values']|join(',') }}],
  331. backgroundColor: ['rgba(219, 220, 85, 0.2)'],
  332. borderColor: ['rgba(219, 220, 85, 1)'],
  333. borderWidth: 2
  334. }]
  335. },
  336. options: getOptions({{ max(statistics['week']['newUsers']['values']) }})
  337. });
  338. {% endif %}
  339. {% if statistics['week']['hits'] is defined %}
  340. const hitsWeekContext = document.getElementById('hitsWeek').getContext('2d');
  341. const hitsWeekChart = new Chart(hitsWeekContext, {
  342. type: 'line',
  343. data: {
  344. labels: [{{ statistics['week']['hits']['labels']|map((elem) => "'#{elem}'")|join(',')|raw }}],
  345. datasets: [{
  346. label: '',
  347. data: [{{ statistics['week']['hits']['values']|join(',') }}],
  348. backgroundColor: [ 'rgba(54, 162, 235, 0.2)' ],
  349. borderColor: [ 'rgba(54, 162, 235, 1)' ],
  350. borderWidth: 2
  351. }]
  352. },
  353. options: getOptions({{ max(statistics['week']['hits']['values']) }})
  354. });
  355. {% endif %}
  356. {% if statistics['week']['sessions'] is defined %}
  357. const sessionsWeekContext = document.getElementById('sessionsWeek').getContext('2d');
  358. const sessionsWeekChart = new Chart(sessionsWeekContext, {
  359. type: 'line',
  360. data: {
  361. labels: [{{ statistics['week']['sessions']['labels']|map((elem) => "'#{elem}'")|join(',')|raw }}],
  362. datasets: [{
  363. label: '',
  364. data: [{{ statistics['week']['sessions']['values']|join(',') }}],
  365. backgroundColor: [ 'rgba(188, 62, 236, 0.2)' ],
  366. borderColor: [ 'rgba(188, 62, 236, 1)' ],
  367. borderWidth: 2
  368. }]
  369. },
  370. options: getOptions({{ max(statistics['week']['sessions']['values']) }})
  371. });
  372. {% endif %}
  373. {% if statistics['week']['avgSessionDuration'] is defined %}
  374. const avgSessionDurationWeekContext = document.getElementById('avgSessionDurationWeek').getContext('2d');
  375. const avgSessionDurationWeekChart = new Chart(avgSessionDurationWeekContext, {
  376. type: 'line',
  377. data: {
  378. labels: [{{ statistics['week']['avgSessionDuration']['labels']|map((elem) => "'#{elem}'")|join(',')|raw }}],
  379. datasets: [{
  380. label: '',
  381. data: [{{ statistics['week']['avgSessionDuration']['values']|join(',') }}],
  382. backgroundColor: [ 'rgba(131, 235, 58, 0.2)' ],
  383. borderColor: [ 'rgba(131, 235, 58, 1)' ],
  384. borderWidth: 2
  385. }]
  386. },
  387. options: getOptions({{ max(statistics['week']['avgSessionDuration']['values']) }})
  388. });
  389. {% endif %}
  390. {% if statistics['week']['bounceRate'] is defined %}
  391. const bounceRateWeekContext = document.getElementById('bounceRateWeek').getContext('2d');
  392. const bounceRateWeekChart = new Chart(bounceRateWeekContext, {
  393. type: 'line',
  394. data: {
  395. labels: [{{ statistics['week']['bounceRate']['labels']|map((elem) => "'#{elem}'")|join(',')|raw }}],
  396. datasets: [{
  397. label: '',
  398. data: [{{ statistics['week']['bounceRate']['values']|join(',') }}],
  399. backgroundColor: [ 'rgba(237, 67, 64, 0.1)' ],
  400. borderColor: [ 'rgba(237, 67, 64, 0.8)' ],
  401. borderWidth: 2
  402. }]
  403. },
  404. options: getOptions({{ max(statistics['week']['bounceRate']['values']) }})
  405. });
  406. {% endif %}
  407. </script>
  408. {% endblock %}