|
22 | 22 |
|
23 | 23 | %main{class: 'my-5'} |
24 | 24 | %section.row.vr-analytics-section.vr-analytics-page-visit-events |
25 | | - .col{ class: @page_visit_events.present? ? "col-lg-9 mb-4" : "col-12" } |
| 25 | + .col{ class: @page_visit_events.load.any? ? "col-lg-9 mb-4" : "col-12" } |
26 | 26 | .d-flex.justify-content-between |
27 | 27 | .vr-analytics-section-header.d-md-flex.justify-content-between.align-items-center |
28 | 28 | .vr-analytics-sub-title |
29 | 29 | = "#{page_name(params[:page])} visits" |
30 | | - - if @page_visit_events.present? |
| 30 | + - if @page_visit_events.load.any? |
31 | 31 | .d-flex.justify-content-between.align-items-center.mt-2.mt-md-0 |
32 | 32 | .vr-analytics-count |
33 | | - = @page_visit_events.count |
| 33 | + = @page_visit_events.size |
34 | 34 | total visits |
35 | 35 | .vr-analytics-percent-change |
36 | | - = display_percent_change(@page_visit_events.count, @previous_period_page_visit_events.count) |
37 | | - .vr-analytics-tooltips{ data: { toggle: "tooltip", placement: "right" }, title: tooltip_content(@page_visit_events.count, @previous_period_page_visit_events.count, params[:interval], @start_date, @end_date) } |
| 36 | + = display_percent_change(@page_visit_events.size, @previous_period_page_visit_events.size) |
| 37 | + .vr-analytics-tooltips{ data: { toggle: "tooltip", placement: "right" }, title: tooltip_content(@page_visit_events.size, @previous_period_page_visit_events.size, params[:interval], @start_date, @end_date) } |
38 | 38 | ? |
39 | 39 | .vr-analytics-section-body |
40 | | - - if @page_visit_events.present? |
| 40 | + - if @page_visit_events.load.any? |
41 | 41 | = column_chart page_visit_chart_data(@page_visit_events, @start_date, @end_date), colors: ["#88DAE3FF", "#D785E3FF", "#F7C85CFF"], library: { plugins: { legend: { position: "top", align: "end", labels: { padding: 24, boxWidth: 8, usePointStyle: true, font: { size: 16 } } } } } |
42 | 42 | - else |
43 | 43 | .vr-analytics-blank-states |
|
58 | 58 | %br |
59 | 59 | :escaped |
60 | 60 | </main> |
61 | | - - if @page_visit_events.present? |
| 61 | + - if @page_visit_events.load.any? |
62 | 62 | .col.col-lg-3 |
63 | 63 | .vr-analytics-card.vr-analytics-page-visit-events-donut-chart |
64 | 64 | %h5 Website visitors |
65 | | - = pie_chart visitors_chart_data(@visits), colors: ['#F7A47B', '#B5E69A'], donut: true, library: { cutout: 85, plugins: { legend: { position: "bottom", align: 'start', labels: {boxWidth: 8, usePointStyle: true, font: { size: 16 } } } } } |
| 65 | + = pie_chart visitors_chart_data(@page_visit_events), colors: ['#F7A47B', '#B5E69A'], donut: true, library: { cutout: 85, plugins: { legend: { position: "bottom", align: 'start', labels: {boxWidth: 8, usePointStyle: true, font: { size: 16 } } } } } |
66 | 66 |
|
67 | 67 |
|
68 | 68 | %hr.m-0 |
69 | | - = render partial: 'events', locals: { events: @click_events, previous_period_events: @previous_period_click_events, title: 'Clicks', type: 'clickables' } |
70 | | - - unless @click_events.present? |
| 69 | + = render partial: 'events', locals: { events_exists: @click_events.load.any?, events_count: @click_events.size, label_grouped_event: @click_events.with_label.group(:label).pluck(:label, Arel.sql('json_agg(ahoy_events.name)')), previous_period_events_count: @previous_period_click_events.size, previous_grouped_events: @previous_period_click_events.with_label.group(:label).size, title: 'Clicks', type: 'clickables' } |
| 70 | + - unless @click_events.load.any? |
71 | 71 | .vr-analytics-blank-states |
72 | 72 | There are no click events within the selected date range. |
73 | 73 | %br |
|
86 | 86 | .vr-analytics-sub-title.col.col-12.col-md-2 |
87 | 87 | Watch time |
88 | 88 |
|
89 | | - - if @video_view_events.present? |
| 89 | + - if @video_view_events.load.any? |
90 | 90 | .col.col-md-10 |
91 | 91 | .row |
92 | 92 | - watch_time = total_watch_time(@video_view_events) |
|
121 | 121 | = display_percent_change(view_percent, previous_view_percent) |
122 | 122 | .vr-analytics-tooltips{ data: { toggle: "tooltip", placement: "right" }, title: tooltip_content(view_percent, previous_view_percent, params[:interval], @start_date, @end_date) } |
123 | 123 | ? |
124 | | - - if @video_view_events.present? |
| 124 | + - if @video_view_events.load.any? |
125 | 125 | .vr-analytics-section-body |
126 | 126 | .vr-analytics-event-label |
127 | 127 | - top_videos = top_three_videos(@video_view_events, @previous_period_video_view_events) |
128 | | - = "Top #{top_videos.count} videos" |
| 128 | + = "Top #{top_videos.size} videos" |
129 | 129 |
|
130 | 130 | .row.mt-4 |
131 | 131 | - top_videos.each do |event| |
|
184 | 184 | Please make sure 'data-violet-resource-id' is present and Analytics mapping is populated |
185 | 185 |
|
186 | 186 | %hr.m-0 |
187 | | - = render partial: 'events', locals: { events: @form_submit_events, previous_period_events: @previous_period_form_submit_events, title: 'Form Submissions', type: 'submitables' } |
188 | | - - unless @form_submit_events.present? |
| 187 | + = render partial: 'events', locals: { events_exists: @form_submit_events.load.any?, events_count: @form_submit_events.size, label_grouped_event: @form_submit_events.with_label.group(:label).pluck(:label, Arel.sql('json_agg(ahoy_events.name)')), previous_period_events_count: @previous_period_form_submit_events.size, previous_grouped_events: @previous_period_form_submit_events.with_label.group(:label).size, title: 'Form Submissions', type: 'submitables' } |
| 188 | + - unless @form_submit_events.load.any? |
189 | 189 | .vr-analytics-blank-states |
190 | 190 | There are no form submission events within the selected date range. |
191 | 191 | %br |
|
217 | 217 | </form> |
218 | 218 |
|
219 | 219 | %hr.m-0 |
220 | | - = render partial: 'events', locals: { events: @section_view_events, previous_period_events: @previous_period_section_view_events, title: 'Section Views', type: 'viewables' } |
221 | | - - unless @section_view_events.present? |
| 220 | + = render partial: 'events', locals: { events_exists: @section_view_events.load.any?, events_count: @section_view_events.size, label_grouped_event: @section_view_events.with_label.group(:label).pluck(:label, Arel.sql('json_agg(ahoy_events.name)')), previous_period_events_count: @previous_period_section_view_events.size, previous_grouped_events: @previous_period_section_view_events.with_label.group(:label).size, title: 'Section Views', type: 'viewables' } |
| 221 | + - unless @section_view_events.load.any? |
222 | 222 | .vr-analytics-blank-states |
223 | 223 | There are no section view events within the selected date range. |
224 | 224 | %br |
|
252 | 252 | By default, the threshold value is 0.75 |
253 | 253 |
|
254 | 254 | %hr.m-0 |
255 | | - = render partial: 'events', locals: { events: @legacy_and_system_events, previous_period_events: @previous_period_legacy_and_system_events, title: 'Events', type: 'events' } |
| 255 | + = render partial: 'events', locals: { events_exists: @legacy_and_system_events.load.any?, events_count: @legacy_and_system_events.size, label_grouped_event: @legacy_and_system_events.with_label.group(:label).pluck(:label, Arel.sql('json_agg(ahoy_events.name)')), previous_period_events_count: @previous_period_legacy_and_system_events.size, previous_grouped_events: @previous_period_legacy_and_system_events.with_label.group(:label).size, title: 'Events', type: 'events' } |
0 commit comments