ish_manager 0.1.8.489 → 0.1.8.490
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f3eeaba4f2df8f0813b9c4c52aa4bfa7526d4dbeccd199b2fae4f5c510dde395
|
|
4
|
+
data.tar.gz: 4a07d354553477353bce3225c42ddd36cd394226b9401a37200544ab08012f4b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 124c737e4fce7120d0d30f7ff0a7945cda87f89f1188611ee1f6006daabb8569c78cdba1184b2d34b2fc42c794fa58df3c8e10a1d12dd55fb542819f81693572
|
|
7
|
+
data.tar.gz: cc2440a9421a471f20b6cc8d9ab8edded0949d0d7e94c2fe6de47b1bb5637a04a985746c14de1ce49569f4f309a5f09a1cac11886daf2de648b0a241014bfff9
|
|
@@ -10,18 +10,24 @@ class IshManager::AnalyticsController < IshManager::ApplicationController
|
|
|
10
10
|
def test
|
|
11
11
|
authorize! :analytics, IshManager::Ability
|
|
12
12
|
|
|
13
|
-
if
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
13
|
+
if params[:prev_interval].present?
|
|
14
|
+
if !@prev_intervals.include?( params[:prev_interval] )
|
|
15
|
+
flash_alert "prev_interval not allowed"
|
|
16
|
+
redirect_to action: :index
|
|
17
|
+
return
|
|
18
|
+
end
|
|
19
|
+
prev_interval = eval( params[:prev_interval] )
|
|
20
|
+
selected_date = "#{(Time.now - prev_interval ).to_date.to_s},#{Time.now.to_date.to_s}"
|
|
21
|
+
else
|
|
22
|
+
selected_date = "#{params[:date_from]},#{params[:date_to]}"
|
|
17
23
|
end
|
|
18
|
-
prev_interval = eval( params[:prev_interval] )
|
|
19
|
-
puts! prev_interval, 'prev_interval'
|
|
20
24
|
|
|
21
25
|
base_url = "https://analytics.wasya.co/index.php?force_api_session=1&module=API&format=JSON&"
|
|
22
|
-
api_url_trash = "&idDimension=1&idSite=2&period=day&date=2023-07-01,2023-09-01"
|
|
26
|
+
# api_url_trash = "&idDimension=1&idSite=2&period=day&date=2023-07-01,2023-09-01"
|
|
23
27
|
opts = {
|
|
24
28
|
"token_auth" => ANALYTICS_TOKEN,
|
|
29
|
+
"filter_limit" => "-1",
|
|
30
|
+
"expanded" => 1,
|
|
25
31
|
|
|
26
32
|
# "method" => "Actions.getPageUrls",
|
|
27
33
|
method: params[:method],
|
|
@@ -31,33 +37,55 @@ class IshManager::AnalyticsController < IshManager::ApplicationController
|
|
|
31
37
|
# "idSite" => 2,
|
|
32
38
|
idSite: params[:idSite],
|
|
33
39
|
|
|
34
|
-
"period" => "day",
|
|
40
|
+
# "period" => "day",
|
|
41
|
+
"period" => "range",
|
|
35
42
|
# period: params[:period],
|
|
36
43
|
|
|
37
|
-
"date" =>
|
|
44
|
+
"date" => selected_date,
|
|
38
45
|
}
|
|
39
46
|
|
|
40
47
|
cids = []
|
|
41
48
|
reports = {}
|
|
49
|
+
reports[9999] = []
|
|
42
50
|
|
|
43
51
|
puts! "#{base_url}#{opts.to_query}", 'ze query'
|
|
44
52
|
|
|
45
53
|
inns = HTTParty.get( "#{base_url}#{opts.to_query}" )
|
|
46
54
|
inns = JSON.parse( inns.body )
|
|
47
55
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
path
|
|
56
|
+
if "Actions.getPageUrls" == params[:method]
|
|
57
|
+
inns.each do |date, items|
|
|
58
|
+
items.each do |item|
|
|
59
|
+
|
|
60
|
+
path = item['label']
|
|
61
|
+
if path[0] != '/'
|
|
62
|
+
path = "/#{path}"
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
cid = path[/.*cid=([\d]*)/,1]&.to_i
|
|
66
|
+
if cid
|
|
67
|
+
cids.push cid
|
|
68
|
+
reports[cid] ||= []
|
|
69
|
+
reports[cid].push "#{date} :: #{path}"
|
|
70
|
+
end
|
|
54
71
|
end
|
|
72
|
+
end
|
|
73
|
+
end
|
|
55
74
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
75
|
+
if "Live.getLastVisitsDetails" == params[:method]
|
|
76
|
+
inns.each do |items|
|
|
77
|
+
date = items['serverDate']
|
|
78
|
+
items['actionDetails'].each do |item|
|
|
79
|
+
path = item['url']
|
|
80
|
+
|
|
81
|
+
cid = path[/.*cid=([\d]*)/,1]&.to_i
|
|
82
|
+
if cid
|
|
83
|
+
cids.push cid
|
|
84
|
+
reports[cid] ||= []
|
|
85
|
+
reports[cid].push "#{date} :: #{path}"
|
|
86
|
+
else
|
|
87
|
+
reports[9999].push "#{date} :: #{path}"
|
|
88
|
+
end
|
|
61
89
|
end
|
|
62
90
|
end
|
|
63
91
|
end
|
|
@@ -67,10 +95,12 @@ class IshManager::AnalyticsController < IshManager::ApplicationController
|
|
|
67
95
|
@reports = {}
|
|
68
96
|
|
|
69
97
|
reports.each do |k, v|
|
|
70
|
-
lead_label = "[#{k}] <#{leads_h[k]
|
|
98
|
+
lead_label = "[#{k}] <#{leads_h[k]&.name} #{leads_h[k]&.email}>"
|
|
71
99
|
@reports[lead_label] = v
|
|
72
100
|
end
|
|
73
101
|
|
|
102
|
+
@reports = @reports.sort
|
|
103
|
+
|
|
74
104
|
end
|
|
75
105
|
|
|
76
106
|
##
|
|
@@ -81,10 +111,12 @@ class IshManager::AnalyticsController < IshManager::ApplicationController
|
|
|
81
111
|
def set_vars
|
|
82
112
|
@methods_list = [
|
|
83
113
|
"Actions.getPageUrls",
|
|
114
|
+
"Live.getLastVisitsDetails",
|
|
84
115
|
]
|
|
85
116
|
|
|
86
117
|
|
|
87
118
|
@prev_intervals = [
|
|
119
|
+
nil,
|
|
88
120
|
"1.month",
|
|
89
121
|
"2.months",
|
|
90
122
|
"3.months",
|
|
@@ -5,14 +5,22 @@
|
|
|
5
5
|
%li= link_to 'Test', analytics_test_path
|
|
6
6
|
|
|
7
7
|
= form_tag( analytics_test_path, method: :get ) do
|
|
8
|
+
|
|
8
9
|
.field
|
|
9
10
|
%label Domain
|
|
10
11
|
= select_tag :idSite, options_for_select(@sites_list, selected: params[:idSite]), class: :select2
|
|
12
|
+
|
|
11
13
|
.field
|
|
12
14
|
%label prev_interval
|
|
13
15
|
= select_tag :prev_interval, options_for_select( @prev_intervals, selected: params[:prev_interval] )
|
|
16
|
+
%label date_from
|
|
17
|
+
= text_field_tag :date_from, params[:date_from]
|
|
18
|
+
%label date_to
|
|
19
|
+
= text_field_tag :date_to, params[:date_to]
|
|
20
|
+
|
|
14
21
|
.field
|
|
15
22
|
%label method
|
|
16
23
|
= select_tag :method, options_for_select( @methods_list, selected: params[:method] )
|
|
24
|
+
|
|
17
25
|
.actions
|
|
18
26
|
= submit_tag 'Submit'
|