ish_manager 0.1.8.488 → 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: 5d6230cc24c1746299a40db13ee998b8ad59fb10cf90c5d4b6efd060f7b43a71
4
- data.tar.gz: b9708207b607a11368db470bcfc76d2e84fb549c9ddef553e062fe4cfc5470a2
3
+ metadata.gz: f3eeaba4f2df8f0813b9c4c52aa4bfa7526d4dbeccd199b2fae4f5c510dde395
4
+ data.tar.gz: 4a07d354553477353bce3225c42ddd36cd394226b9401a37200544ab08012f4b
5
5
  SHA512:
6
- metadata.gz: 3c9b239cfd2593b44bcbe50bfdcb92ea7fb3479d01a5e496b37afd78e8e010048c73d2b10469a0fa30d647ee2098d22a64e170b4318190f3fb80cdd5d11f44c6
7
- data.tar.gz: 6a82bf2054f9efaa665365d1bf2cba8e8384ed55ae431cfe84fe5780e6dc2d3d987a590fa62811842e45cf36686e67094edc451714e25e56fc02c3cd4de057a0
6
+ metadata.gz: 124c737e4fce7120d0d30f7ff0a7945cda87f89f1188611ee1f6006daabb8569c78cdba1184b2d34b2fc42c794fa58df3c8e10a1d12dd55fb542819f81693572
7
+ data.tar.gz: cc2440a9421a471f20b6cc8d9ab8edded0949d0d7e94c2fe6de47b1bb5637a04a985746c14de1ce49569f4f309a5f09a1cac11886daf2de648b0a241014bfff9
@@ -42,6 +42,11 @@
42
42
  .thumbnails {
43
43
  .item {
44
44
  border: 1px solid blue;
45
+ display: flex;
46
+
47
+ > * {
48
+ margin-right: .5em;
49
+ }
45
50
  }
46
51
  }
47
52
 
@@ -1,38 +1,91 @@
1
1
 
2
2
  class IshManager::AnalyticsController < IshManager::ApplicationController
3
3
 
4
+ before_action :set_vars
5
+
6
+ def index
7
+ authorize! :analytics, IshManager::Ability
8
+ end
9
+
4
10
  def test
5
11
  authorize! :analytics, IshManager::Ability
6
12
 
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]}"
23
+ end
24
+
7
25
  base_url = "https://analytics.wasya.co/index.php?force_api_session=1&module=API&format=JSON&"
26
+ # api_url_trash = "&idDimension=1&idSite=2&period=day&date=2023-07-01,2023-09-01"
8
27
  opts = {
9
- "method" => "Actions.getPageUrls",
10
28
  "token_auth" => ANALYTICS_TOKEN,
29
+ "filter_limit" => "-1",
30
+ "expanded" => 1,
31
+
32
+ # "method" => "Actions.getPageUrls",
33
+ method: params[:method],
34
+
11
35
  "idDimension" => 1,
12
- "idSite" => 2,
13
- "period" => "day",
14
- "date" => "#{(Time.now - 3.months ).to_date.to_s},#{Time.now.to_date.to_s}",
36
+
37
+ # "idSite" => 2,
38
+ idSite: params[:idSite],
39
+
40
+ # "period" => "day",
41
+ "period" => "range",
42
+ # period: params[:period],
43
+
44
+ "date" => selected_date,
15
45
  }
16
- api_url = "&idDimension=1&idSite=2&period=day&date=2023-07-01,2023-09-01"
46
+
17
47
  cids = []
18
48
  reports = {}
49
+ reports[9999] = []
50
+
51
+ puts! "#{base_url}#{opts.to_query}", 'ze query'
19
52
 
20
53
  inns = HTTParty.get( "#{base_url}#{opts.to_query}" )
21
54
  inns = JSON.parse( inns.body )
22
55
 
23
- inns.each do |date, items|
24
- items.each do |item|
56
+ if "Actions.getPageUrls" == params[:method]
57
+ inns.each do |date, items|
58
+ items.each do |item|
25
59
 
26
- path = item['label']
27
- if path[0] != '/'
28
- path = "/#{path}"
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
29
71
  end
72
+ end
73
+ end
74
+
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']
30
80
 
31
- cid = path[/.*cid=([\d]*)/,1]&.to_i
32
- if cid
33
- cids.push cid
34
- reports[cid] ||= []
35
- reports[cid].push "#{date} :: #{path}"
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
36
89
  end
37
90
  end
38
91
  end
@@ -42,10 +95,50 @@ class IshManager::AnalyticsController < IshManager::ApplicationController
42
95
  @reports = {}
43
96
 
44
97
  reports.each do |k, v|
45
- email = leads_h[k].email
46
- @reports[email] = v
98
+ lead_label = "[#{k}] <#{leads_h[k]&.name} #{leads_h[k]&.email}>"
99
+ @reports[lead_label] = v
47
100
  end
48
101
 
102
+ @reports = @reports.sort
103
+
104
+ end
105
+
106
+ ##
107
+ ## private
108
+ ##
109
+ private
110
+
111
+ def set_vars
112
+ @methods_list = [
113
+ "Actions.getPageUrls",
114
+ "Live.getLastVisitsDetails",
115
+ ]
116
+
117
+
118
+ @prev_intervals = [
119
+ nil,
120
+ "1.month",
121
+ "2.months",
122
+ "3.months",
123
+ ]
124
+
125
+ @sites_list = [
126
+ [ '2 - wasya.co', 2 ],
127
+ [ '6 - wasyaco.com', 6 ],
128
+
129
+ [ '3 - old pi', 3 ],
130
+ [ '8 - pi_drup', 8 ],
131
+
132
+
133
+ [ 'bjjc_drup', 9 ],
134
+ [ 'bjjc_legacy', 12 ],
135
+
136
+ [ 'demmitv', 7 ],
137
+
138
+ [ 'ish', 5 ],
139
+
140
+
141
+ ]
49
142
  end
50
143
 
51
144
  end
@@ -0,0 +1,26 @@
1
+
2
+ .analytics--menu
3
+
4
+ %ul
5
+ %li= link_to 'Test', analytics_test_path
6
+
7
+ = form_tag( analytics_test_path, method: :get ) do
8
+
9
+ .field
10
+ %label Domain
11
+ = select_tag :idSite, options_for_select(@sites_list, selected: params[:idSite]), class: :select2
12
+
13
+ .field
14
+ %label prev_interval
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
+
21
+ .field
22
+ %label method
23
+ = select_tag :method, options_for_select( @methods_list, selected: params[:method] )
24
+
25
+ .actions
26
+ = submit_tag 'Submit'
@@ -0,0 +1,6 @@
1
+
2
+ .analytics-index.max-width
3
+ %h5 Analytics Index
4
+
5
+ = render 'ish_manager/analytics/menu'
6
+ %hr
@@ -1,5 +1,9 @@
1
1
 
2
2
  .analytics-test.maxwidth
3
+ %h5 Analytics Test
4
+
5
+ = render 'ish_manager/analytics/menu'
6
+ %hr
3
7
 
4
8
  %ul
5
9
  - @reports.each do |email, paths|
@@ -105,6 +105,7 @@
105
105
  = link_to '[+]', new_office_action_path
106
106
  %li
107
107
  = link_to 'Unsubs', unsubscribes_path
108
+ = link_to 'Analytics', analytics_path
108
109
 
109
110
  .c
110
111
 
data/config/routes.rb CHANGED
@@ -6,6 +6,7 @@ IshManager::Engine.routes.draw do
6
6
  ##
7
7
  root :to => 'application#home'
8
8
 
9
+ get 'analytics', to: 'analytics#index'
9
10
  get 'analytics/test', to: 'analytics#test'
10
11
 
11
12
  get 'application/tinymce', to: 'application#tinymce'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ish_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8.488
4
+ version: 0.1.8.490
5
5
  platform: ruby
6
6
  authors:
7
7
  - piousbox
@@ -568,6 +568,8 @@ files:
568
568
  - app/views/202212 Mailchimp Templates/202212 theme subtle.html
569
569
  - app/views/202212 Mailchimp Templates/202212 theme ticket.html
570
570
  - app/views/202212 Mailchimp Templates/202212 theme whale.html
571
+ - app/views/ish_manager/analytics/_menu.haml
572
+ - app/views/ish_manager/analytics/index.haml
571
573
  - app/views/ish_manager/analytics/test.haml
572
574
  - app/views/ish_manager/appliance_tmpls/_form.haml
573
575
  - app/views/ish_manager/appliance_tmpls/index.haml