ahoy_captain 0.1.0 → 0.77
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +20 -0
- data/README.md +55 -14
- data/Rakefile +1 -10
- data/app/assets/images/ahoy_captain/apple-touch-icon.png +0 -0
- data/app/assets/images/ahoy_captain/favicon-16x16.png +0 -0
- data/app/assets/images/ahoy_captain/favicon-32x32.png +0 -0
- data/app/assets/images/ahoy_captain/logo.png +0 -0
- data/app/assets/images/ahoy_captain/safari-pinned-tab.svg +199 -0
- data/app/assets/javascript/ahoy_captain/application.js +4 -0
- data/app/assets/javascript/ahoy_captain/controllers/application.js +9 -0
- data/app/assets/javascript/ahoy_captain/controllers/application_controller.js +14 -0
- data/app/assets/javascript/ahoy_captain/controllers/details_modal_controller.js +18 -0
- data/app/assets/javascript/ahoy_captain/controllers/dropdown_label_controller.js +14 -0
- data/app/assets/javascript/ahoy_captain/controllers/filter_controller.js +145 -0
- data/app/assets/javascript/ahoy_captain/controllers/filter_tag_controller.js +17 -0
- data/app/assets/javascript/ahoy_captain/controllers/funnel_chart_controller.js +143 -0
- data/app/assets/javascript/ahoy_captain/controllers/index.js +3 -0
- data/app/assets/javascript/ahoy_captain/controllers/link_controller.js +43 -0
- data/app/assets/javascript/ahoy_captain/controllers/navigation_controller.js +25 -0
- data/app/assets/javascript/ahoy_captain/controllers/realtime_controller.js +27 -0
- data/app/assets/manifest/ahoy_captain/manifest.js +2 -0
- data/app/components/ahoy_captain/dropdown_button_component.html.erb +16 -0
- data/app/components/ahoy_captain/dropdown_button_component.rb +14 -0
- data/app/components/ahoy_captain/dropdown_link_component.html.erb +19 -0
- data/app/components/ahoy_captain/dropdown_link_component.rb +15 -0
- data/app/components/ahoy_captain/filter/modal_component.html.erb +13 -0
- data/app/components/ahoy_captain/filter/modal_component.rb +13 -0
- data/app/components/ahoy_captain/filter/select_component.html.erb +21 -0
- data/app/components/ahoy_captain/filter/select_component.rb +32 -0
- data/app/components/ahoy_captain/filter/tag_component.html.erb +9 -0
- data/app/components/ahoy_captain/filter/tag_component.rb +38 -0
- data/app/components/ahoy_captain/filter/tag_container_component.html.erb +5 -0
- data/app/components/ahoy_captain/filter/tag_container_component.rb +13 -0
- data/app/components/ahoy_captain/sticky_nav_component.html.erb +37 -0
- data/app/components/ahoy_captain/sticky_nav_component.rb +5 -0
- data/app/components/ahoy_captain/table_component.html.erb +49 -0
- data/app/components/ahoy_captain/table_component.rb +28 -0
- data/app/components/ahoy_captain/tile_component.html.erb +12 -0
- data/app/components/ahoy_captain/tile_component.rb +16 -0
- data/app/components/ahoy_captain/tooltip_component.html.erb +3 -0
- data/app/components/ahoy_captain/tooltip_component.rb +18 -0
- data/app/controllers/ahoy_captain/application_controller.rb +83 -0
- data/app/controllers/ahoy_captain/campaigns_controller.rb +27 -0
- data/app/controllers/ahoy_captain/cities_controller.rb +24 -0
- data/app/controllers/ahoy_captain/countries_controller.rb +24 -0
- data/app/controllers/ahoy_captain/devices_controller.rb +23 -0
- data/app/controllers/ahoy_captain/entry_pages_controller.rb +21 -0
- data/app/controllers/ahoy_captain/exit_pages_controller.rb +20 -0
- data/app/controllers/ahoy_captain/filters/base_controller.rb +17 -0
- data/app/controllers/ahoy_captain/filters/locations_controller.rb +11 -0
- data/app/controllers/ahoy_captain/filters/operating_systems/names_controller.rb +13 -0
- data/app/controllers/ahoy_captain/filters/operating_systems/versions_controller.rb +13 -0
- data/app/controllers/ahoy_captain/filters/pages/actions_controller.rb +13 -0
- data/app/controllers/ahoy_captain/filters/pages/entry_pages_controller.rb +14 -0
- data/app/controllers/ahoy_captain/filters/pages/exit_pages_controller.rb +16 -0
- data/app/controllers/ahoy_captain/filters/screens_controller.rb +11 -0
- data/app/controllers/ahoy_captain/filters/sources_controller.rb +11 -0
- data/app/controllers/ahoy_captain/filters/utms_controller.rb +10 -0
- data/app/controllers/ahoy_captain/funnels_controller.rb +8 -0
- data/app/controllers/ahoy_captain/goals_controller.rb +7 -0
- data/app/controllers/ahoy_captain/realtimes_controller.rb +7 -0
- data/app/controllers/ahoy_captain/regions_controller.rb +24 -0
- data/app/controllers/ahoy_captain/roots_controller.rb +6 -0
- data/app/controllers/ahoy_captain/sources_controller.rb +24 -0
- data/app/controllers/ahoy_captain/stats/base_controller.rb +6 -0
- data/app/controllers/ahoy_captain/stats/bounce_rates_controller.rb +10 -0
- data/app/controllers/ahoy_captain/stats/total_pageviews_controller.rb +9 -0
- data/app/controllers/ahoy_captain/stats/total_visits_controller.rb +9 -0
- data/app/controllers/ahoy_captain/stats/unique_visitors_controller.rb +9 -0
- data/app/controllers/ahoy_captain/stats/views_per_visits_controller.rb +16 -0
- data/app/controllers/ahoy_captain/stats/visit_durations_controller.rb +9 -0
- data/app/controllers/ahoy_captain/stats_controller.rb +7 -0
- data/app/controllers/ahoy_captain/top_pages_controller.rb +26 -0
- data/app/decorators/ahoy_captain/application_decorator.rb +34 -0
- data/app/decorators/ahoy_captain/campaign_decorator.rb +19 -0
- data/app/decorators/ahoy_captain/city_decorator.rb +12 -0
- data/app/decorators/ahoy_captain/country_decorator.rb +28 -0
- data/app/decorators/ahoy_captain/device_decorator.rb +16 -0
- data/app/decorators/ahoy_captain/entry_page_decorator.rb +7 -0
- data/app/decorators/ahoy_captain/exit_page_decorator.rb +7 -0
- data/app/decorators/ahoy_captain/page_decorator.rb +16 -0
- data/app/decorators/ahoy_captain/region_decorator.rb +12 -0
- data/app/decorators/ahoy_captain/source_decorator.rb +20 -0
- data/app/decorators/ahoy_captain/top_page_decorator.rb +7 -0
- data/app/helpers/ahoy_captain/application_helper.rb +32 -0
- data/app/models/ahoy_captain/current.rb +9 -0
- data/app/models/ahoy_captain/rangeable.rb +10 -0
- data/app/models/ahoy_captain/url_helpers.rb +6 -0
- data/app/models/ahoy_captain/widget.rb +15 -0
- data/app/models/concerns/ahoy_captain/range_options.rb +21 -0
- data/app/presenters/ahoy_captain/dashboard_presenter.rb +81 -0
- data/app/presenters/ahoy_captain/funnel_presenter.rb +65 -0
- data/app/presenters/ahoy_captain/goals_presenter.rb +60 -0
- data/app/queries/ahoy_captain/application_query.rb +118 -0
- data/app/queries/ahoy_captain/entry_pages_query.rb +17 -0
- data/app/queries/ahoy_captain/event_query.rb +20 -0
- data/app/queries/ahoy_captain/exit_pages_query.rb +17 -0
- data/app/queries/ahoy_captain/stats/average_views_per_visit_query.rb +13 -0
- data/app/queries/ahoy_captain/stats/average_visit_duration_query.rb +15 -0
- data/app/queries/ahoy_captain/stats/bounce_rates_query.rb +14 -0
- data/app/queries/ahoy_captain/stats/total_pageviews_query.rb +9 -0
- data/app/queries/ahoy_captain/stats/total_visitors_query.rb +9 -0
- data/app/queries/ahoy_captain/stats/unique_visitors_query.rb +9 -0
- data/app/queries/ahoy_captain/stats/views_per_visit_query.rb +17 -0
- data/app/queries/ahoy_captain/stats/visit_duration_query.rb +16 -0
- data/app/queries/ahoy_captain/visit_query.rb +32 -0
- data/app/views/ahoy_captain/campaigns/index.html+details.erb +4 -0
- data/app/views/ahoy_captain/campaigns/index.html.erb +3 -0
- data/app/views/ahoy_captain/cities/index.html+details.erb +4 -0
- data/app/views/ahoy_captain/cities/index.html.erb +3 -0
- data/app/views/ahoy_captain/countries/index.html+details.erb +5 -0
- data/app/views/ahoy_captain/countries/index.html.erb +3 -0
- data/app/views/ahoy_captain/devices/index.html+details.erb +4 -0
- data/app/views/ahoy_captain/devices/index.html.erb +3 -0
- data/app/views/ahoy_captain/entry_pages/index.html+details.erb +4 -0
- data/app/views/ahoy_captain/entry_pages/index.html.erb +3 -0
- data/app/views/ahoy_captain/exit_pages/index.html+details.erb +4 -0
- data/app/views/ahoy_captain/exit_pages/index.html.erb +3 -0
- data/app/views/ahoy_captain/funnels/index.html.erb +7 -0
- data/app/views/ahoy_captain/funnels/show.html.erb +6 -0
- data/app/views/ahoy_captain/goals/index.html.erb +39 -0
- data/app/views/ahoy_captain/layouts/application.html.erb +127 -0
- data/app/views/ahoy_captain/realtimes/show.html.erb +9 -0
- data/app/views/ahoy_captain/regions/index.html+details.erb +4 -0
- data/app/views/ahoy_captain/regions/index.html.erb +3 -0
- data/app/views/ahoy_captain/roots/show.html.erb +179 -0
- data/app/views/ahoy_captain/sources/index.html+details.erb +4 -0
- data/app/views/ahoy_captain/sources/index.html.erb +3 -0
- data/app/views/ahoy_captain/stats/base/index.html.erb +3 -0
- data/app/views/ahoy_captain/stats/show.html.erb +57 -0
- data/app/views/ahoy_captain/top_pages/index.html+details.erb +4 -0
- data/app/views/ahoy_captain/top_pages/index.html.erb +3 -0
- data/config/routes.rb +56 -0
- data/lib/ahoy_captain/active_record.rb +108 -0
- data/lib/ahoy_captain/ahoy/event_methods.rb +114 -0
- data/lib/ahoy_captain/ahoy/visit_methods.rb +23 -0
- data/lib/ahoy_captain/configuration.rb +43 -0
- data/lib/ahoy_captain/engine.rb +24 -0
- data/lib/ahoy_captain/funnels.rb +44 -0
- data/lib/ahoy_captain/goals.rb +39 -0
- data/lib/ahoy_captain/period_collection.rb +115 -0
- data/lib/ahoy_captain/railtie.rb +7 -0
- data/lib/ahoy_captain/version.rb +1 -3
- data/lib/ahoy_captain.rb +50 -4
- data/lib/generators/ahoy_captain/install_generator.rb +18 -0
- data/lib/generators/ahoy_captain/templates/config.rb.tt +123 -0
- metadata +393 -17
- data/.rspec +0 -3
- data/.rubocop.yml +0 -13
- data/CHANGELOG.md +0 -5
- data/Gemfile +0 -12
- data/ahoy_captain.gemspec +0 -37
- data/sig/ahoy_captain.rbs +0 -4
@@ -0,0 +1,17 @@
|
|
1
|
+
module AhoyCaptain
|
2
|
+
module Stats
|
3
|
+
class ViewsPerVisitQuery < ApplicationQuery
|
4
|
+
def build
|
5
|
+
events = event_query
|
6
|
+
.joins(:visit)
|
7
|
+
.select("#{::AhoyCaptain.visit.table_name}.started_at as started_at, count(name) / count(distinct visit_id) as views_per_visit")
|
8
|
+
.where(name: AhoyCaptain.config.event[:view_name])
|
9
|
+
.group("started_at, visit_id")
|
10
|
+
|
11
|
+
::Ahoy::Visit
|
12
|
+
.select("views_per_visit as views_per_visit")
|
13
|
+
.from(events, :views_per_visit_table)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module AhoyCaptain
|
2
|
+
module Stats
|
3
|
+
class VisitDurationQuery < ApplicationQuery
|
4
|
+
def build
|
5
|
+
events = event_query
|
6
|
+
.select("max(time) - min(time) as duration, visit_id")
|
7
|
+
.group("visit_id")
|
8
|
+
|
9
|
+
::Ahoy::Visit
|
10
|
+
.joins("inner join ahoy_visits on ahoy_visits.id = views_per_visit_table.visit_id")
|
11
|
+
.select("duration as duration, ahoy_visits.started_at")
|
12
|
+
.from(events, :views_per_visit_table)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
module AhoyCaptain
|
2
|
+
class VisitQuery < ApplicationQuery
|
3
|
+
include Rangeable
|
4
|
+
|
5
|
+
def build
|
6
|
+
::Ahoy::Visit.ransack(ransack_params_for(:visit)).result
|
7
|
+
end
|
8
|
+
|
9
|
+
def within_range
|
10
|
+
if range
|
11
|
+
abort
|
12
|
+
@query = @query.where('started_at >= ? and started_at < ?', range[0], range[1])
|
13
|
+
end
|
14
|
+
|
15
|
+
self
|
16
|
+
end
|
17
|
+
|
18
|
+
def with_events
|
19
|
+
@query = @query.joins(:events)
|
20
|
+
|
21
|
+
self
|
22
|
+
end
|
23
|
+
|
24
|
+
def is_a?(other)
|
25
|
+
if other == ActiveRecord::Relation
|
26
|
+
return true
|
27
|
+
end
|
28
|
+
|
29
|
+
super(other)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<%= turbo_frame_tag :goals do %>
|
2
|
+
<div class="flex flex-col min-h-[380px] w-full pt-4">
|
3
|
+
<div class="flex text-sm font-bold text-base-content mb-4">
|
4
|
+
<span class="grow">Goal</span>
|
5
|
+
<span >Uniques</span>
|
6
|
+
<span class="w-8 ml-8 text-right">Total</span>
|
7
|
+
<span class="w-8 ml-8 text-right">CR</span>
|
8
|
+
</div>
|
9
|
+
<div class='min-h-[420px]'>
|
10
|
+
<div class="grow">
|
11
|
+
<% if @presenter.goals.respond_to?(:each) && @presenter.goals.any? %>
|
12
|
+
<% @presenter.goals.each do |item| %>
|
13
|
+
<div class='leading-10 flex relative'>
|
14
|
+
<progress class='progress-primary bg-base-100 h-8 grow' value="<%= item.uniques %>" max="<%= item.total %>">
|
15
|
+
</progress>
|
16
|
+
<span class="grow text-elipsis overflow-hidden absolute left-4 bottom-3 h-8 text-base-content">
|
17
|
+
<%= item.name %>
|
18
|
+
</span>
|
19
|
+
<span class="w-8 ml-8 text-right">
|
20
|
+
<%= render AhoyCaptain::TooltipComponent.new(amount: item.uniques) %>
|
21
|
+
</span>
|
22
|
+
<span class="w-8 ml-8 text-right">
|
23
|
+
<%= render AhoyCaptain::TooltipComponent.new(amount: item.total) %>
|
24
|
+
</span>
|
25
|
+
|
26
|
+
<span class="w-8 ml-8 text-right">
|
27
|
+
<%= item.conversion_rate %>%
|
28
|
+
</span>
|
29
|
+
</div>
|
30
|
+
<% end %>
|
31
|
+
<% else %>
|
32
|
+
<p>No data found</p>
|
33
|
+
<% end %>
|
34
|
+
</div>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
|
38
|
+
|
39
|
+
<% end %>
|
@@ -0,0 +1,127 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<title>Ahoy Captain</title>
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
6
|
+
<%= csrf_meta_tags %>
|
7
|
+
<%= csp_meta_tag %>
|
8
|
+
<meta name="creator" content="joshmn">
|
9
|
+
<meta name="author" content="joshmn">
|
10
|
+
<meta name="contact" content="https://github.com/joshmn">
|
11
|
+
<meta name="twitter:creator" content="joshmn">
|
12
|
+
<meta name="twitter:site" content="josh.mn">
|
13
|
+
<meta name="og:site" content="josh.mn">
|
14
|
+
<meta name="description" content="Ahoy Captain">
|
15
|
+
<meta name="og:description" content="Ahoy Captain">
|
16
|
+
<link rel="icon" type="image/png" sizes="32x32" href="<%= image_path "ahoy_captain/favicon-32x32.png" %>">
|
17
|
+
<link rel="apple-touch-icon" sizes="180x180" href="<%= image_path "ahoy_captain/apple-touch-icon.png" %>">
|
18
|
+
<link rel="icon" type="image/png" sizes="16x16" href="<%= image_path "ahoy_captain/favicon-16x16.png" %>">
|
19
|
+
<link rel="mask-icon" href="<%= image_path "ahoy_captain/safari-pinned-tab.svg" %>" color="#5bbad5">
|
20
|
+
<meta name="msapplication-TileColor" content="#da532c">
|
21
|
+
<meta name="theme-color" content="#ffffff">
|
22
|
+
<link href="https://cdn.jsdelivr.net/npm/daisyui@3.5.0/dist/full.css" rel="stylesheet" type="text/css"/>
|
23
|
+
<script src="https://cdn.tailwindcss.com"></script>
|
24
|
+
<link href="https://unpkg.com/slim-select@latest/dist/slimselect.css" rel="stylesheet" />
|
25
|
+
<%= ahoy_captain_importmap_tags %>
|
26
|
+
<style>
|
27
|
+
/* Application styles */
|
28
|
+
:root {
|
29
|
+
--ss-bg-color: hsl(var(--b1) / 1);
|
30
|
+
--ss-font-color: hsl(var(--bc) / var(--tw-text-opacity, 1));
|
31
|
+
}
|
32
|
+
|
33
|
+
.ss-content{
|
34
|
+
position:absolute;
|
35
|
+
display:none;
|
36
|
+
height:auto;
|
37
|
+
flex-direction:column;
|
38
|
+
width:auto;
|
39
|
+
max-height:var(--ss-content-height);
|
40
|
+
box-sizing:border-box;
|
41
|
+
border:solid 1px var(--ss-border-color);
|
42
|
+
background-color:var(--ss-bg-color);
|
43
|
+
transition:transform var(--ss-animation-timing),opacity var(--ss-animation-timing);
|
44
|
+
opacity:0;
|
45
|
+
transform:scaleY(0);
|
46
|
+
transform-origin:center top;
|
47
|
+
overflow:hidden;
|
48
|
+
z-index:10000;
|
49
|
+
}
|
50
|
+
|
51
|
+
.ss-content.ss-open-below{
|
52
|
+
opacity:1;
|
53
|
+
transform:scaleY(1);
|
54
|
+
transform-origin:center top;
|
55
|
+
border-bottom-left-radius:var(--ss-border-radius);
|
56
|
+
border-bottom-right-radius:var(--ss-border-radius);
|
57
|
+
bottom: -100%;
|
58
|
+
right: 41%;
|
59
|
+
display: flex;
|
60
|
+
}
|
61
|
+
|
62
|
+
.ss-open-below.ss-content.ss-relevant {
|
63
|
+
bottom: -100%;
|
64
|
+
right: 41%;
|
65
|
+
}
|
66
|
+
|
67
|
+
.pagy-nav.pagination {
|
68
|
+
isolation: isolate;
|
69
|
+
display: inline-flex;
|
70
|
+
margin-right: -1px;
|
71
|
+
/* border-radius: 0.375rem; */
|
72
|
+
box-shadow: 0 1px 2px 0 hsl(var(--n) / var(--tw-text-opacity, 1));
|
73
|
+
}
|
74
|
+
|
75
|
+
.page.next a, .page.prev a, .page.next.disabled, .page.prev.disabled, .page a, .page.gap {
|
76
|
+
position: relative;
|
77
|
+
display: inline-flex;
|
78
|
+
align-items: center;
|
79
|
+
border: 1px solid hsl(var(--n) / var(--tw-text-opacity, 1));
|
80
|
+
padding: 0.5rem 1rem;
|
81
|
+
font-size: 0.875rem;
|
82
|
+
font-weight: 500;
|
83
|
+
color: hsl(var(--bc) / var(--tw-text-opacity, 1));
|
84
|
+
}
|
85
|
+
|
86
|
+
.page.next a:hover, .page.prev a:hover, .page a:hover {
|
87
|
+
background-color: hsl(var(--b3) / var(--tw-text-opacity, 1));
|
88
|
+
color: hsl(var(--ac) / var(--tw-text-opacity, 1));
|
89
|
+
}
|
90
|
+
|
91
|
+
.page.next a:focus, .page.prev a:focus, .page.next.disabled:focus, .page.prev.disabled:focus, .page a:focus, .page.gap:focus {
|
92
|
+
z-index: 20;
|
93
|
+
}
|
94
|
+
|
95
|
+
.page.prev a, .page.next a {
|
96
|
+
border-radius: 0.375rem 0 0 0.375rem;
|
97
|
+
background-color: hsl(var(--b2) /1);
|
98
|
+
}
|
99
|
+
|
100
|
+
|
101
|
+
.page.next.disabled, .page.prev.disabled {
|
102
|
+
border-radius: 0.375rem 0 0 0.375rem;
|
103
|
+
background-color: hsl(var(--b2) / 0.5);
|
104
|
+
}
|
105
|
+
|
106
|
+
.page.active {
|
107
|
+
z-index: 10;
|
108
|
+
border-color: hsl(var(--a) / var(--tw-text-opacity, 1));
|
109
|
+
background-color: hsl(var(--b3) / var(--tw-text-opacity, 1));
|
110
|
+
color: hsl(var(--ac) / var(--tw-text-opacity, 1));
|
111
|
+
border-radius: 0.375rem;
|
112
|
+
padding: 0.5rem 1rem;
|
113
|
+
font-size: 0.875rem;
|
114
|
+
font-weight: 500;
|
115
|
+
}
|
116
|
+
</style>
|
117
|
+
</head>
|
118
|
+
|
119
|
+
<body data-theme='<%= AhoyCaptain.config.theme %>' class='bg-base-300' data-controller='navigation' data-action="filter-tag:remove->navigation#removeQueryParam">
|
120
|
+
<%= yield %>
|
121
|
+
<div class="flex justify-center bg-base-300 border-t-4 border-base-100 py-4">
|
122
|
+
<div class="flex justify-around space-x-4 my-4">
|
123
|
+
<h5>Powered by <a href='https://github.com/joshmn/ahoy_captain' target=”_blank”>Ahoy Captain v<%= AhoyCaptain::VERSION %></a></h5>
|
124
|
+
</div>
|
125
|
+
</div>
|
126
|
+
</body>
|
127
|
+
</html>
|
@@ -0,0 +1,9 @@
|
|
1
|
+
<%= turbo_frame_tag :realtime do %>
|
2
|
+
<div>
|
3
|
+
<a class="block ml-1 md:ml-2 mr-auto text-xs md:text-sm font-bold text-base-content dark:text-base-content" title="" data-realtime-target="label">
|
4
|
+
<svg class="inline w-2 mr-1 md:mr-2 text-green-500 fill-current animate-pulse" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
|
5
|
+
<circle cx="8" cy="8" r="8"></circle>
|
6
|
+
</svg><%= @total %> <span class="hidden sm:inline-block">current visitors</span>
|
7
|
+
</a>
|
8
|
+
</div>
|
9
|
+
<% end %>
|
@@ -0,0 +1,179 @@
|
|
1
|
+
<main class='bg-base-300 min-h-screen pb-4 max-w-6xl mx-auto' data-controller="application">
|
2
|
+
<%= render AhoyCaptain::StickyNavComponent.new do |nav| %>
|
3
|
+
<% nav.with_realtime_update do %>
|
4
|
+
<%= turbo_frame_tag :realtime, src: realtime_path, data: { controller: "realtime" }, loading: :lazy %>
|
5
|
+
<% end %>
|
6
|
+
<% end %>
|
7
|
+
|
8
|
+
<div class="grid grid-cols-1 lg:grid-cols-2 grid-flow-row gap-4">
|
9
|
+
<%= render AhoyCaptain::TileComponent.new(wide: true) do |component| %>
|
10
|
+
<% component.with_statistic_display do %>
|
11
|
+
<%= turbo_frame_tag :stats, src: stats_path(search_params), loading: :lazy %>
|
12
|
+
<% end %>
|
13
|
+
<% end %>
|
14
|
+
|
15
|
+
<%= render AhoyCaptain::TileComponent.new(title: 'Top Sources') do |component| %>
|
16
|
+
<% component.with_display_links do %>
|
17
|
+
<div data-controller='link' data-link-top_sources-class="text-primary underline">
|
18
|
+
<a href="<%= sources_path(search_params) %>"data-turbo-frame="sources" data-action='click->link#changeTopSources' data-link-target='top_sourcesLink'>All</a>
|
19
|
+
<%= render AhoyCaptain::DropdownLinkComponent.new(title: "Campaign") do |dropdown| %>
|
20
|
+
<% %w{utm_source utm_medium utm_term utm_content utm_campaign}.each do |source| %>
|
21
|
+
<% dropdown.with_option do %>
|
22
|
+
<a href="<%= public_send("campaign_#{source}_path".to_sym, **search_params) %>" data-turbo-frame="sources" data-action='click->link#changeTopSources' data-link-target='top_sourcesLink'>
|
23
|
+
<%= source.titleize.gsub("Utm", "UTM") %>
|
24
|
+
</a>
|
25
|
+
<% end %>
|
26
|
+
<% end %>
|
27
|
+
<% end %>
|
28
|
+
</div>
|
29
|
+
<% end %>
|
30
|
+
<% component.with_statistic_display do %>
|
31
|
+
<%= turbo_frame_tag :sources, src: sources_path(search_params), loading: :lazy %>
|
32
|
+
<% end %>
|
33
|
+
<% component.with_details_cta do %>
|
34
|
+
<button data-action="click->details-modal#openModal" data-controller="details-modal" data-details-modal-target-value="#sources" class="link no-underline">Details</button>
|
35
|
+
<% end %>
|
36
|
+
<% end %>
|
37
|
+
|
38
|
+
<%= render AhoyCaptain::TileComponent.new(title: 'Top Pages') do |component| %>
|
39
|
+
<% component.with_display_links do %>
|
40
|
+
<div data-controller='link' data-link-top_pages-class="text-primary underline" >
|
41
|
+
<a href="<%= top_pages_path(search_params) %>" data-turbo-frame="pages" data-action='click->link#changeTopPages' data-link-target='top_pagesLink'>Top Pages</a>
|
42
|
+
<a href="<%= entry_pages_path(search_params) %>" data-turbo-frame="pages" data-action='click->link#changeTopPages' data-link-target='top_pagesLink'>Entry Pages</a>
|
43
|
+
<a href="<%= exit_pages_path(search_params) %>" data-turbo-frame="pages" data-action='click->link#changeTopPages' data-link-target='top_pagesLink'>Exit Pages</a>
|
44
|
+
</div>
|
45
|
+
<% end %>
|
46
|
+
<% component.with_statistic_display do %>
|
47
|
+
<%= turbo_frame_tag :pages, src: top_pages_path(search_params), loading: :lazy %>
|
48
|
+
<% end %>
|
49
|
+
<% component.with_details_cta do %>
|
50
|
+
<button data-action="click->details-modal#openModal" data-controller="details-modal" data-details-modal-target-value="#pages" class="link no-underline">Details</button>
|
51
|
+
<% end %>
|
52
|
+
<% end %>
|
53
|
+
|
54
|
+
<%= render AhoyCaptain::TileComponent.new(title: 'Countries') do |component| %>
|
55
|
+
<% component.with_display_links do %>
|
56
|
+
<div data-controller='link' data-link-countries-class="text-primary underline">
|
57
|
+
<a href="<%= countries_path(search_params) %>" data-turbo-frame="geography" data-action='click->link#changeCountries' data-link-target='countriesLink'>Countries</a>
|
58
|
+
<a href="<%= regions_path(search_params) %>" data-turbo-frame="geography" data-action='click->link#changeCountries' data-link-target='countriesLink'>Regions</a>
|
59
|
+
<a href="<%= cities_path(search_params) %>" data-turbo-frame="geography" data-action='click->link#changeCountries' data-link-target='countriesLink'>Cities</a>
|
60
|
+
</div>
|
61
|
+
<% end %>
|
62
|
+
<% component.with_statistic_display do %>
|
63
|
+
<%= turbo_frame_tag :geography, src: countries_path(search_params), loading: :lazy %>
|
64
|
+
<% end %>
|
65
|
+
<% component.with_details_cta do %>
|
66
|
+
<button data-action="click->details-modal#openModal" data-controller="details-modal" data-details-modal-target-value="#geography" class="link no-underline">Details</button>
|
67
|
+
<% end %>
|
68
|
+
<% end %>
|
69
|
+
|
70
|
+
<%= render AhoyCaptain::TileComponent.new(title: 'Devices') do |component| %>
|
71
|
+
<% component.with_display_links do %>
|
72
|
+
<div data-controller='link' data-link-devices-class="text-primary underline">
|
73
|
+
<a href="<%= devices_browsers_path(search_params) %>" data-turbo-frame="devices" data-action='click->link#changeDevices' data-link-target='devicesLink'>Browser</a>
|
74
|
+
<a href="<%= devices_operating_systems_path(search_params) %>" data-turbo-frame="devices" data-action='click->link#changeDevices' data-link-target='devicesLink'>OS</a>
|
75
|
+
<a href="<%= devices_device_types_path(search_params) %>" data-turbo-frame="devices" data-action='click->link#changeDevices' data-link-target='devicesLink'>Size</a>
|
76
|
+
</div>
|
77
|
+
<% end %>
|
78
|
+
<% component.with_statistic_display do %>
|
79
|
+
<%= turbo_frame_tag :devices, src: devices_browsers_path(search_params), loading: :lazy %>
|
80
|
+
<% end %>
|
81
|
+
<% component.with_details_cta do %>
|
82
|
+
<button data-action="click->details-modal#openModal" data-controller="details-modal" data-details-modal-target-value="#devices" class="link no-underline">Details</button>
|
83
|
+
<% end %>
|
84
|
+
<% end %>
|
85
|
+
<%= render AhoyCaptain::TileComponent.new(wide: true) do |component| %>
|
86
|
+
<% component.with_display_links do %>
|
87
|
+
<a href="<%= goals_path(search_params) %>" data-turbo-frame="goals" class="link link-primary">
|
88
|
+
Goals
|
89
|
+
</a>
|
90
|
+
<%= render AhoyCaptain::DropdownLinkComponent.new(title: "Funnels") do |dropdown| %>
|
91
|
+
<% AhoyCaptain.config.funnels.each do |id, funnel| %>
|
92
|
+
<% dropdown.with_option do %>
|
93
|
+
<a href="<%= funnel_path(id, search_params) %>" data-turbo-frame="goals" class="link link-primary">
|
94
|
+
<%= funnel.title %>
|
95
|
+
</a>
|
96
|
+
<% end %>
|
97
|
+
<% end %>
|
98
|
+
<% end %>
|
99
|
+
|
100
|
+
<% end %>
|
101
|
+
<% component.with_statistic_display do %>
|
102
|
+
<%= turbo_frame_tag :goals, src: goals_path(search_params), loading: :lazy %>
|
103
|
+
<% end %>
|
104
|
+
<% end %>
|
105
|
+
</div>
|
106
|
+
</main>
|
107
|
+
|
108
|
+
<%= render AhoyCaptain::Filter::ModalComponent.new(title: "Filter by Page", id: "pageModal") do |modal| %>
|
109
|
+
<% modal.with_modal_display do %>
|
110
|
+
<%= render AhoyCaptain::Filter::SelectComponent.new(label: "Action", column: :route, url: filters_actions_path, predicates: [:in, :not_in]) %>
|
111
|
+
<%= render AhoyCaptain::Filter::SelectComponent.new(label: "Entry page", column: :entry_page, url: filters_entry_pages_path, predicates: [:in, :not_in]) %>
|
112
|
+
<%= render AhoyCaptain::Filter::SelectComponent.new(label: "Exit page", column: :exit_page, url: filters_exit_pages_path, predicates: [:in, :not_in]) %>
|
113
|
+
<% end %>
|
114
|
+
<% end %>
|
115
|
+
|
116
|
+
<%= render AhoyCaptain::Filter::ModalComponent.new(title: "Filter by Country", id: "countryModal") do |modal| %>
|
117
|
+
<% modal.with_modal_display do %>
|
118
|
+
<%= render AhoyCaptain::Filter::SelectComponent.new(label: "Country", column: :country, url: filters_locations_countries_path, predicates: [:in, :not_in]) %>
|
119
|
+
<%= render AhoyCaptain::Filter::SelectComponent.new(label: "Region", column: :region, url: filters_locations_regions_path, predicates: [:in, :not_in]) %>
|
120
|
+
<%= render AhoyCaptain::Filter::SelectComponent.new(label: "City", column: :city, url: filters_locations_cities_path, predicates: [:in, :not_in]) %>
|
121
|
+
<% end %>
|
122
|
+
<% end %>
|
123
|
+
|
124
|
+
<%= render AhoyCaptain::Filter::ModalComponent.new(title: "Filter by Source", id: "sourceModal") do |modal| %>
|
125
|
+
<% modal.with_modal_display do %>
|
126
|
+
<%= render AhoyCaptain::Filter::SelectComponent.new(label: "Source", column: :referring_domain, url: filters_sources_path, predicates: [:in, :not_in]) %>
|
127
|
+
<% end %>
|
128
|
+
<% end %>
|
129
|
+
|
130
|
+
<%= render AhoyCaptain::Filter::ModalComponent.new(title: "Filter by Screen size", id: "screenModal") do |modal| %>
|
131
|
+
<% modal.with_modal_display do %>
|
132
|
+
<%= render AhoyCaptain::Filter::SelectComponent.new(label: "Screen size", column: :device_type, url: filters_screens_path, predicates: [:in, :not_in]) %>
|
133
|
+
<% end %>
|
134
|
+
<% end %>
|
135
|
+
|
136
|
+
<%= render AhoyCaptain::Filter::ModalComponent.new(title: "Filter by Browser", id: "osModal") do |modal| %>
|
137
|
+
<% modal.with_modal_display do %>
|
138
|
+
<%= render AhoyCaptain::Filter::SelectComponent.new(label: "Operating System", column: :os, url: filters_names_path, predicates: [:in, :not_in]) %>
|
139
|
+
<%= render AhoyCaptain::Filter::SelectComponent.new(label: "Operating System Version", column: :os_version, url: filters_versions_path, predicates: [:in, :not_in]) %>
|
140
|
+
<% end %>
|
141
|
+
<% end %>
|
142
|
+
|
143
|
+
<%= render AhoyCaptain::Filter::ModalComponent.new(title: "Filter by Campaign", id: "utmModal") do |modal| %>
|
144
|
+
<% modal.with_modal_display do %>
|
145
|
+
<%= render AhoyCaptain::Filter::SelectComponent.new(label: "UTM Medium", column: :utm_medium, url: filters_utm_mediums_path, predicates: [:in, :not_in]) %>
|
146
|
+
<%= render AhoyCaptain::Filter::SelectComponent.new(label: "UTM Source", column: :utm_source, url: filters_utm_sources_path, predicates: [:in, :not_in]) %>
|
147
|
+
<%= render AhoyCaptain::Filter::SelectComponent.new(label: "UTM Campaign", column: :utm_campaign, url: filters_utm_campaigns_path, predicates: [:in, :not_in]) %>
|
148
|
+
<%= render AhoyCaptain::Filter::SelectComponent.new(label: "UTM Term", column: :utm_term, url: filters_utm_terms_path, predicates: [:in, :not_in]) %>
|
149
|
+
<%= render AhoyCaptain::Filter::SelectComponent.new(label: "UTM Content", column: :utm_content, url: filters_utm_contents_path, predicates: [:in, :not_in]) %>
|
150
|
+
<% end %>
|
151
|
+
<% end %>
|
152
|
+
|
153
|
+
<%= render AhoyCaptain::Filter::ModalComponent.new(title: "Custom Range", id: "customRangeModal") do |modal| %>
|
154
|
+
<% modal.with_modal_display do %>
|
155
|
+
<div class="flex gap-2 w-full">
|
156
|
+
<div class="form-control w-full max-w-xs">
|
157
|
+
<label class="label">
|
158
|
+
<span class="label-text">Start Date</span>
|
159
|
+
</label>
|
160
|
+
<input type="datetime-local" name="start_date" class="input input-bordered w-full" value="<%= params[:start_date] %>" />
|
161
|
+
</div>
|
162
|
+
<div class="form-control w-full max-w-xs">
|
163
|
+
<label class="label">
|
164
|
+
<span class="label-text">End Date</span>
|
165
|
+
</label>
|
166
|
+
<input type="datetime-local" name="end_date" class="input input-bordered w-full" value="<%= params[:end_date] %>" />
|
167
|
+
</div>
|
168
|
+
</div>
|
169
|
+
<% end %>
|
170
|
+
<% end %>
|
171
|
+
|
172
|
+
<dialog id="detailsModal" class="modal">
|
173
|
+
<div class="modal-box w-11/12 max-w-5xl">
|
174
|
+
<%= turbo_frame_tag :details %>
|
175
|
+
</div>
|
176
|
+
<form method="dialog" class="modal-backdrop">
|
177
|
+
<button>close</button>
|
178
|
+
</form>
|
179
|
+
</dialog>
|
@@ -0,0 +1,57 @@
|
|
1
|
+
<%= turbo_frame_tag :stats do %>
|
2
|
+
<dl class="grid grid-cols-1 divide-y divide-base-200 overflow-hidden rounded-lg grid-cols-2 md:grid-cols-6 md:divide-y-0 -mt-4 mb-4">
|
3
|
+
<a href="<%= stats_unique_visitors_url(search_params) %>" data-turbo-frame="chart">
|
4
|
+
<dt class="text-base font-normal text-base-content">Unique Visitors</dt>
|
5
|
+
<dd class="mt-1 flex items-baseline justify-between md:block lg:flex">
|
6
|
+
<div class="flex items-baseline text-2xl font-semibold text-accent-content">
|
7
|
+
<%= number_with_delimiter @presenter.unique_visitors %>
|
8
|
+
</div>
|
9
|
+
</dd>
|
10
|
+
</a>
|
11
|
+
<a href="<%= stats_total_visits_path(search_params) %>" data-turbo-frame="chart">
|
12
|
+
<dt class="text-base font-normal text-base-content">Total Visits</dt>
|
13
|
+
<dd class="mt-1 flex items-baseline justify-between md:block lg:flex">
|
14
|
+
<div class="flex items-baseline text-2xl font-semibold text-accent-content">
|
15
|
+
<%= number_with_delimiter @presenter.total_visits %>
|
16
|
+
</div>
|
17
|
+
</dd>
|
18
|
+
</a>
|
19
|
+
<a href="<%= stats_total_pageviews_path(search_params) %>" data-turbo-frame="chart">
|
20
|
+
<dt class="text-base font-normal text-base-content">Total Pageviews</dt>
|
21
|
+
<dd class="mt-1 flex items-baseline justify-between md:block lg:flex">
|
22
|
+
<div class="flex items-baseline text-2xl font-semibold text-accent-content">
|
23
|
+
<%= number_with_delimiter @presenter.total_pageviews %>
|
24
|
+
</div>
|
25
|
+
</dd>
|
26
|
+
</a>
|
27
|
+
<a href="<%= stats_views_per_visits_path(search_params) %>" data-turbo-frame="chart">
|
28
|
+
|
29
|
+
<dt class="text-base font-normal text-base-content">Views per visit</dt>
|
30
|
+
<dd class="mt-1 flex items-baseline justify-between md:block lg:flex">
|
31
|
+
<div class="flex items-baseline text-2xl font-semibold text-accent-content">
|
32
|
+
<%= number_with_delimiter @presenter.views_per_visit %>
|
33
|
+
</div>
|
34
|
+
</dd>
|
35
|
+
</a>
|
36
|
+
<a href="<%= stats_bounce_rates_path(search_params) %>" data-turbo-frame="chart">
|
37
|
+
|
38
|
+
<dt class="text-base font-normal text-base-content">Bounce rate</dt>
|
39
|
+
<dd class="mt-1 flex items-baseline justify-between md:block lg:flex">
|
40
|
+
<div class="flex items-baseline text-2xl font-semibold text-accent-content">
|
41
|
+
<%= number_with_delimiter @presenter.bounce_rate * 100 %>%
|
42
|
+
</div>
|
43
|
+
</dd>
|
44
|
+
</a>
|
45
|
+
<a href="<%= stats_visit_durations_path(search_params) %>" data-turbo-frame="chart">
|
46
|
+
|
47
|
+
<dt class="text-base font-normal text-base-content">Visit duration</dt>
|
48
|
+
<dd class="mt-1 flex items-baseline justify-between md:block lg:flex">
|
49
|
+
<div class="flex items-baseline text-2xl font-semibold text-accent-content">
|
50
|
+
<%= @presenter.visit_duration %>
|
51
|
+
</div>
|
52
|
+
</dd>
|
53
|
+
</a>
|
54
|
+
</dl>
|
55
|
+
<%= turbo_frame_tag :chart, src: stats_unique_visitors_path(search_params) do %>
|
56
|
+
<% end %>
|
57
|
+
<% end %>
|