ahoy_captain 0.81 → 0.82
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascript/ahoy_captain/controllers/active_links_controller.js +15 -0
- data/app/assets/javascript/ahoy_captain/controllers/filter_form_controller.js +13 -0
- data/app/assets/javascript/ahoy_captain/controllers/line_chart_controller.js +37 -0
- data/app/assets/javascript/ahoy_captain/controllers/predicate_select_controller.js +10 -0
- data/app/assets/javascript/ahoy_captain/controllers/realtime_controller.js +2 -0
- data/app/assets/javascript/ahoy_captain/controllers/search_select_controller.js +65 -0
- data/app/components/ahoy_captain/filter/modal_component.html.erb +6 -5
- data/app/components/ahoy_captain/filter/select_component.html.erb +13 -11
- data/app/components/ahoy_captain/filter/select_component.rb +21 -4
- data/app/components/ahoy_captain/table_component.html.erb +2 -35
- data/app/components/ahoy_captain/table_component.rb +13 -5
- data/app/components/ahoy_captain/tables/headers/devices_header_component.html.erb +3 -0
- data/app/components/ahoy_captain/tables/headers/devices_header_component.rb +9 -0
- data/app/components/ahoy_captain/tables/headers/goals_header_component.html.erb +6 -0
- data/app/components/ahoy_captain/tables/headers/goals_header_component.rb +9 -0
- data/app/components/ahoy_captain/tables/headers/header_component.html.erb +5 -0
- data/app/components/ahoy_captain/tables/headers/header_component.rb +12 -0
- data/app/components/ahoy_captain/tables/rows/devices_row_component.html.erb +5 -0
- data/app/components/ahoy_captain/tables/rows/devices_row_component.rb +12 -0
- data/app/components/ahoy_captain/tables/rows/goals_row_component.html.erb +11 -0
- data/app/components/ahoy_captain/tables/rows/goals_row_component.rb +12 -0
- data/app/components/ahoy_captain/tables/rows/row_component.html.erb +6 -0
- data/app/components/ahoy_captain/tables/rows/row_component.rb +41 -0
- data/app/controllers/ahoy_captain/filters/pages/entry_pages_controller.rb +2 -2
- data/app/controllers/ahoy_captain/filters/pages/exit_pages_controller.rb +1 -2
- data/app/controllers/ahoy_captain/filters/properties/names_controller.rb +11 -0
- data/app/controllers/ahoy_captain/filters/properties/values_controller.rb +15 -0
- data/app/controllers/ahoy_captain/stats/bounce_rates_controller.rb +1 -0
- data/app/controllers/ahoy_captain/stats/total_pageviews_controller.rb +1 -0
- data/app/controllers/ahoy_captain/stats/total_visits_controller.rb +1 -0
- data/app/controllers/ahoy_captain/stats/unique_visitors_controller.rb +1 -0
- data/app/controllers/ahoy_captain/stats/views_per_visits_controller.rb +3 -0
- data/app/controllers/ahoy_captain/stats/visit_durations_controller.rb +1 -0
- data/app/queries/ahoy_captain/application_query.rb +4 -3
- data/app/queries/ahoy_captain/event_query.rb +17 -15
- data/app/queries/ahoy_captain/visit_query.rb +1 -1
- data/app/views/ahoy_captain/devices/_table.html.erb +5 -0
- data/app/views/ahoy_captain/devices/index.html+details.erb +1 -1
- data/app/views/ahoy_captain/devices/index.html.erb +2 -2
- data/app/views/ahoy_captain/goals/index.html.erb +3 -35
- data/app/views/ahoy_captain/layouts/application.html.erb +1 -1
- data/app/views/ahoy_captain/roots/show.html.erb +81 -73
- data/app/views/ahoy_captain/stats/base/index.html.erb +2 -3
- data/config/routes.rb +6 -0
- data/lib/ahoy_captain/ahoy/event_methods.rb +28 -74
- data/lib/ahoy_captain/goals.rb +9 -1
- data/lib/ahoy_captain/version.rb +1 -1
- metadata +21 -18
- data/app/assets/javascript/ahoy_captain/controllers/filter_controller.js +0 -151
- data/app/assets/javascript/ahoy_captain/controllers/link_controller.js +0 -43
- data/app/assets/javascript/ahoy_captain/controllers/navigation_controller.js +0 -25
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ahoy_captain
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.82'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- joshmn
|
@@ -262,20 +262,6 @@ dependencies:
|
|
262
262
|
- - ">="
|
263
263
|
- !ruby/object:Gem::Version
|
264
264
|
version: '0'
|
265
|
-
- !ruby/object:Gem::Dependency
|
266
|
-
name: pp_sql
|
267
|
-
requirement: !ruby/object:Gem::Requirement
|
268
|
-
requirements:
|
269
|
-
- - ">="
|
270
|
-
- !ruby/object:Gem::Version
|
271
|
-
version: '0'
|
272
|
-
type: :development
|
273
|
-
prerelease: false
|
274
|
-
version_requirements: !ruby/object:Gem::Requirement
|
275
|
-
requirements:
|
276
|
-
- - ">="
|
277
|
-
- !ruby/object:Gem::Version
|
278
|
-
version: '0'
|
279
265
|
description: A full-featured, mountable analytics dashboard for your Rails app, powered
|
280
266
|
by Ahoy.
|
281
267
|
email:
|
@@ -292,18 +278,20 @@ files:
|
|
292
278
|
- app/assets/images/ahoy_captain/logo.png
|
293
279
|
- app/assets/images/ahoy_captain/safari-pinned-tab.svg
|
294
280
|
- app/assets/javascript/ahoy_captain/application.js
|
281
|
+
- app/assets/javascript/ahoy_captain/controllers/active_links_controller.js
|
295
282
|
- app/assets/javascript/ahoy_captain/controllers/application.js
|
296
283
|
- app/assets/javascript/ahoy_captain/controllers/application_controller.js
|
297
284
|
- app/assets/javascript/ahoy_captain/controllers/details_modal_controller.js
|
298
285
|
- app/assets/javascript/ahoy_captain/controllers/dropdown_label_controller.js
|
299
|
-
- app/assets/javascript/ahoy_captain/controllers/
|
286
|
+
- app/assets/javascript/ahoy_captain/controllers/filter_form_controller.js
|
300
287
|
- app/assets/javascript/ahoy_captain/controllers/filter_tag_controller.js
|
301
288
|
- app/assets/javascript/ahoy_captain/controllers/funnel_chart_controller.js
|
302
289
|
- app/assets/javascript/ahoy_captain/controllers/index.js
|
303
290
|
- app/assets/javascript/ahoy_captain/controllers/interval_controller.js
|
304
|
-
- app/assets/javascript/ahoy_captain/controllers/
|
305
|
-
- app/assets/javascript/ahoy_captain/controllers/
|
291
|
+
- app/assets/javascript/ahoy_captain/controllers/line_chart_controller.js
|
292
|
+
- app/assets/javascript/ahoy_captain/controllers/predicate_select_controller.js
|
306
293
|
- app/assets/javascript/ahoy_captain/controllers/realtime_controller.js
|
294
|
+
- app/assets/javascript/ahoy_captain/controllers/search_select_controller.js
|
307
295
|
- app/assets/manifest/ahoy_captain/manifest.js
|
308
296
|
- app/components/ahoy_captain/dropdown_button_component.html.erb
|
309
297
|
- app/components/ahoy_captain/dropdown_button_component.rb
|
@@ -321,6 +309,18 @@ files:
|
|
321
309
|
- app/components/ahoy_captain/sticky_nav_component.rb
|
322
310
|
- app/components/ahoy_captain/table_component.html.erb
|
323
311
|
- app/components/ahoy_captain/table_component.rb
|
312
|
+
- app/components/ahoy_captain/tables/headers/devices_header_component.html.erb
|
313
|
+
- app/components/ahoy_captain/tables/headers/devices_header_component.rb
|
314
|
+
- app/components/ahoy_captain/tables/headers/goals_header_component.html.erb
|
315
|
+
- app/components/ahoy_captain/tables/headers/goals_header_component.rb
|
316
|
+
- app/components/ahoy_captain/tables/headers/header_component.html.erb
|
317
|
+
- app/components/ahoy_captain/tables/headers/header_component.rb
|
318
|
+
- app/components/ahoy_captain/tables/rows/devices_row_component.html.erb
|
319
|
+
- app/components/ahoy_captain/tables/rows/devices_row_component.rb
|
320
|
+
- app/components/ahoy_captain/tables/rows/goals_row_component.html.erb
|
321
|
+
- app/components/ahoy_captain/tables/rows/goals_row_component.rb
|
322
|
+
- app/components/ahoy_captain/tables/rows/row_component.html.erb
|
323
|
+
- app/components/ahoy_captain/tables/rows/row_component.rb
|
324
324
|
- app/components/ahoy_captain/tile_component.html.erb
|
325
325
|
- app/components/ahoy_captain/tile_component.rb
|
326
326
|
- app/components/ahoy_captain/tooltip_component.html.erb
|
@@ -340,6 +340,8 @@ files:
|
|
340
340
|
- app/controllers/ahoy_captain/filters/pages/actions_controller.rb
|
341
341
|
- app/controllers/ahoy_captain/filters/pages/entry_pages_controller.rb
|
342
342
|
- app/controllers/ahoy_captain/filters/pages/exit_pages_controller.rb
|
343
|
+
- app/controllers/ahoy_captain/filters/properties/names_controller.rb
|
344
|
+
- app/controllers/ahoy_captain/filters/properties/values_controller.rb
|
343
345
|
- app/controllers/ahoy_captain/filters/screens_controller.rb
|
344
346
|
- app/controllers/ahoy_captain/filters/sources_controller.rb
|
345
347
|
- app/controllers/ahoy_captain/filters/utms_controller.rb
|
@@ -403,6 +405,7 @@ files:
|
|
403
405
|
- app/views/ahoy_captain/cities/index.html.erb
|
404
406
|
- app/views/ahoy_captain/countries/index.html+details.erb
|
405
407
|
- app/views/ahoy_captain/countries/index.html.erb
|
408
|
+
- app/views/ahoy_captain/devices/_table.html.erb
|
406
409
|
- app/views/ahoy_captain/devices/index.html+details.erb
|
407
410
|
- app/views/ahoy_captain/devices/index.html.erb
|
408
411
|
- app/views/ahoy_captain/entry_pages/index.html+details.erb
|
@@ -1,151 +0,0 @@
|
|
1
|
-
import { Controller } from '@hotwired/stimulus';
|
2
|
-
import SlimSelect from 'slim-select';
|
3
|
-
|
4
|
-
export default class extends Controller {
|
5
|
-
static values = {
|
6
|
-
url: String,
|
7
|
-
column: String,
|
8
|
-
};
|
9
|
-
|
10
|
-
static targets = ['select', 'predicate'];
|
11
|
-
|
12
|
-
connect() {
|
13
|
-
this.selectTargets.forEach(async (target) => {
|
14
|
-
const url = target.dataset.filterUrlValue;
|
15
|
-
const optionsSearch = this.fetchOptions(url, target);
|
16
|
-
const select = await new SlimSelect({
|
17
|
-
select: target,
|
18
|
-
data: [],
|
19
|
-
settings: {
|
20
|
-
contentPosition: 'relative',
|
21
|
-
contentLocation: target.closest('fieldset'),
|
22
|
-
searchText: 'Sorry, no results found',
|
23
|
-
searchPlaceholder: 'Type to populate results',
|
24
|
-
placeholderText: `Search for ${target.dataset.filterColumnValue}`,
|
25
|
-
searchHighlight: true,
|
26
|
-
},
|
27
|
-
events: {
|
28
|
-
beforeOpen: async () => {
|
29
|
-
if (!this.#hasData(target) && !this.#hasSelections(target)) {
|
30
|
-
const data = await optionsSearch();
|
31
|
-
target.slim.setData(data);
|
32
|
-
}
|
33
|
-
},
|
34
|
-
search: async (search, currentData) => {
|
35
|
-
const data = await optionsSearch(search);
|
36
|
-
// eslint-disable-next-line max-len
|
37
|
-
const filteredData = data.filter((item) => !currentData.some((selectedItem) => selectedItem.text === item.text));
|
38
|
-
return filteredData;
|
39
|
-
},
|
40
|
-
beforeChange: this.#beforeChange(target, url),
|
41
|
-
},
|
42
|
-
});
|
43
|
-
const json = JSON.parse(target.dataset.filterSelected);
|
44
|
-
if (json.length) {
|
45
|
-
select.setData(json.map((item) => ({ text: item, value: item })));
|
46
|
-
select.setSelected(json);
|
47
|
-
}
|
48
|
-
});
|
49
|
-
}
|
50
|
-
|
51
|
-
fetchOptions(url, target) {
|
52
|
-
return async (search) => {
|
53
|
-
const query = this.#buildQueryFilters(search, target);
|
54
|
-
const response = await fetch(`${url}?${query.toString()}`);
|
55
|
-
const data = await response.json();
|
56
|
-
return data;
|
57
|
-
};
|
58
|
-
}
|
59
|
-
|
60
|
-
#buildQueryFilters(search, target) {
|
61
|
-
const query = new URLSearchParams(window.location.search);
|
62
|
-
const otherFilters = this.selectTargets.filter((filter) => filter !== target);
|
63
|
-
otherFilters.forEach((filter) => {
|
64
|
-
filter.slim.getSelected().forEach((val) => {
|
65
|
-
const filterName = `${filter.name}[]`;
|
66
|
-
if (query.has(filterName)) {
|
67
|
-
if (!query.get(`${filter.name}[]`).includes(val)) {
|
68
|
-
query.append(filterName, val);
|
69
|
-
}
|
70
|
-
} else {
|
71
|
-
query.append(filterName, val);
|
72
|
-
}
|
73
|
-
});
|
74
|
-
});
|
75
|
-
query.set(`q[${target.dataset.filterColumnValue}_i_cont]`, search || '');
|
76
|
-
return query;
|
77
|
-
}
|
78
|
-
|
79
|
-
#beforeChange(target) {
|
80
|
-
return () => {
|
81
|
-
const otherFilters = this.selectTargets.filter((filter) => filter !== target);
|
82
|
-
otherFilters.forEach(async (filter) => {
|
83
|
-
if (this.#hasData(filter)) {
|
84
|
-
const selected = filter.slim.getSelected();
|
85
|
-
filter.slim.setData(selected.map((text) => ({ text })));
|
86
|
-
// setting data triggers a slim render, so need to also set selected again
|
87
|
-
filter.slim.setSelected(selected);
|
88
|
-
}
|
89
|
-
});
|
90
|
-
return true;
|
91
|
-
};
|
92
|
-
}
|
93
|
-
|
94
|
-
#hasData(target) {
|
95
|
-
return target.slim.getData().length !== 0;
|
96
|
-
}
|
97
|
-
|
98
|
-
#hasSelections(target) {
|
99
|
-
return target.slim.getSelected().length !== 0;
|
100
|
-
}
|
101
|
-
|
102
|
-
#filtersForQuery() {
|
103
|
-
// eslint-disable-next-line max-len
|
104
|
-
const predicates = this.predicateTargets.map((el) => ({ name: el.name, column_predicate: el.value }));
|
105
|
-
// eslint-disable-next-line max-len
|
106
|
-
const filterValues = this.selectTargets.map((el) => ({ name: el.name, selections: el.slim.getSelected() }));
|
107
|
-
const mergedData = predicates.map((predicate) => {
|
108
|
-
const matchingFilter = filterValues.find((filter) => filter.name === predicate.name);
|
109
|
-
if (matchingFilter.selections.length > 0) {
|
110
|
-
return { ...predicate, ...matchingFilter };
|
111
|
-
}
|
112
|
-
return undefined;
|
113
|
-
}).filter((el) => el !== undefined);
|
114
|
-
return mergedData;
|
115
|
-
}
|
116
|
-
|
117
|
-
resetFilters(event) {
|
118
|
-
this.selectTargets.forEach((el) => {
|
119
|
-
el.slim.setSelected([]);
|
120
|
-
});
|
121
|
-
this.applyFilters(event);
|
122
|
-
}
|
123
|
-
|
124
|
-
applyFilters(e) {
|
125
|
-
e.preventDefault();
|
126
|
-
const searchParams = new URLSearchParams(window.location.search);
|
127
|
-
const filters = this.#filtersForQuery();
|
128
|
-
filters.forEach((filter) => {
|
129
|
-
const name = `q[${filter.column_predicate}][]`;
|
130
|
-
const selectedValues = searchParams.getAll(name);
|
131
|
-
filter.selections.forEach((selection) => {
|
132
|
-
if (selectedValues) {
|
133
|
-
if (!selectedValues.includes(selection)) {
|
134
|
-
searchParams.append(name, selection);
|
135
|
-
}
|
136
|
-
} else {
|
137
|
-
searchParams.append(name, selection);
|
138
|
-
}
|
139
|
-
});
|
140
|
-
});
|
141
|
-
['input[name="start_date"]', 'input[name="end_date"]'].forEach((selector) => {
|
142
|
-
const el = document.querySelector(selector);
|
143
|
-
if (el.value.length) {
|
144
|
-
searchParams.delete('period');
|
145
|
-
}
|
146
|
-
searchParams.set(el.name, el.value);
|
147
|
-
});
|
148
|
-
|
149
|
-
Turbo.visit(`${window.location.pathname.replace(/\/$/, '')}?${searchParams.toString()}`);
|
150
|
-
}
|
151
|
-
}
|
@@ -1,43 +0,0 @@
|
|
1
|
-
import { Controller } from '@hotwired/stimulus';
|
2
|
-
|
3
|
-
export default class extends Controller {
|
4
|
-
static targets = ['countriesLink', 'top_pagesLink', 'devicesLink', 'top_sourcesLink'];
|
5
|
-
|
6
|
-
static classes = ['countries', 'top_pages', 'devices', 'top_sources'];
|
7
|
-
|
8
|
-
changeCountries(event) {
|
9
|
-
event.currentTarget.classList.add(...this.countriesClasses);
|
10
|
-
this.countriesLinkTargets.forEach((target) => {
|
11
|
-
if (target !== event.currentTarget) {
|
12
|
-
target.classList.remove(...this.countriesClasses);
|
13
|
-
}
|
14
|
-
});
|
15
|
-
}
|
16
|
-
|
17
|
-
changeTopSources(event) {
|
18
|
-
event.currentTarget.classList.add(...this.top_sourcesClasses);
|
19
|
-
this.top_sourcesLinkTargets.forEach((target) => {
|
20
|
-
if (target !== event.currentTarget) {
|
21
|
-
target.classList.remove(...this.top_sourcesClasses);
|
22
|
-
}
|
23
|
-
});
|
24
|
-
}
|
25
|
-
|
26
|
-
changeTopPages(event) {
|
27
|
-
event.currentTarget.classList.add(...this.top_pagesClasses);
|
28
|
-
this.top_pagesLinkTargets.forEach((target) => {
|
29
|
-
if (target !== event.currentTarget) {
|
30
|
-
target.classList.remove(...this.top_pagesClasses);
|
31
|
-
}
|
32
|
-
});
|
33
|
-
}
|
34
|
-
|
35
|
-
changeDevices(event) {
|
36
|
-
event.currentTarget.classList.add(...this.devicesClasses);
|
37
|
-
this.devicesLinkTargets.forEach((target) => {
|
38
|
-
if (target !== event.currentTarget) {
|
39
|
-
target.classList.remove(...this.devicesClasses);
|
40
|
-
}
|
41
|
-
});
|
42
|
-
}
|
43
|
-
}
|
@@ -1,25 +0,0 @@
|
|
1
|
-
import { Controller } from '@hotwired/stimulus';
|
2
|
-
|
3
|
-
export default class extends Controller {
|
4
|
-
connect() {
|
5
|
-
this.queryString = new URLSearchParams(window.location.search);
|
6
|
-
this.baseURL = window.location.pathname.replace(/\/$/, '');
|
7
|
-
}
|
8
|
-
|
9
|
-
navigate() {
|
10
|
-
const url = `${this.baseURL}?${this.queryString.toString()}`;
|
11
|
-
Turbo.visit(url, { action: 'replace' });
|
12
|
-
}
|
13
|
-
|
14
|
-
addQueryParam({ detail: { paramKey, paramValue } }) {
|
15
|
-
this.queryString.append(paramKey, paramValue);
|
16
|
-
}
|
17
|
-
|
18
|
-
removeQueryParam({ detail: { paramKey, paramValue } }) {
|
19
|
-
if (!this.queryString.has(paramKey)) {
|
20
|
-
paramKey += '[]';
|
21
|
-
}
|
22
|
-
this.queryString.delete(paramKey, paramValue);
|
23
|
-
this.navigate();
|
24
|
-
}
|
25
|
-
}
|