shopify_dashboard_plus 0.0.6 → 0.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -7
- data/lib/shopify_dashboard_plus/helpers.rb +6 -2
- data/lib/shopify_dashboard_plus/report.rb +17 -5
- data/lib/shopify_dashboard_plus/version.rb +1 -1
- data/public/css/common.css +4 -0
- data/views/report.erb +110 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fdfd548de3a3601bf7e6b95a270e47cf5ceaa27
|
4
|
+
data.tar.gz: a1d785b1ac756ff95eafd897167ae39ed0035429
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2024bcd98be9ced7b9c41a68fdeecf114c0556d7f7a13b2d9dfbe8d39dea0e8bfa2565ef0da7c359332812b3a72d6cab3fbefc10bc9b3052aa4b8f5f204c8ec2
|
7
|
+
data.tar.gz: bd114f9ed38cc8ad8f71241835518977db22e486839db4f8ef38a031e64b1bceb94493c59b77ee058349e64af043267221c4bf91aaec6bbc7aee649829736bf5
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Shopify_Dashboard_Plus[![Gem Version](https://badge.fury.io/rb/shopify_dashboard_plus.svg)](http://badge.fury.io/rb/shopify_dashboard_plus)
|
1
|
+
# Shopify_Dashboard_Plus [![Gem Version](https://badge.fury.io/rb/shopify_dashboard_plus.svg)](http://badge.fury.io/rb/shopify_dashboard_plus)
|
2
2
|
Pretty Dashboard for Shopify Admin with lots of graphs.
|
3
3
|
|
4
4
|
## Screenshots
|
@@ -43,12 +43,12 @@ Choose the interval over which to get data and see it displayed as:
|
|
43
43
|
* `git clone https://github.com/at1as/Shopify_Dashboard_Plus.git`
|
44
44
|
* To install using the gem:
|
45
45
|
* `gem install shopify_dashboard_plus`
|
46
|
-
*
|
47
|
-
* `shopify_dashboard_plus.gemfile`
|
46
|
+
* `shopify_dashboard_plus.rb`
|
48
47
|
* Retrieve `API Key`, `Password` and `Shop Name` for your store from Shopify Admin
|
49
48
|
* Run (key, password & name can be passed as environment variables, or later thorugh the UI):
|
50
|
-
* `SHP_KEY="
|
51
|
-
|
49
|
+
* `SHP_KEY="API KEY" SHP_PWD="PASSWORD" SHP_NAME="SHOP NAME" ./lib/shopify_dashboard_plus.rb`
|
50
|
+
|
52
51
|
## Notes
|
53
|
-
* Tested and developed with Ruby 2.1.2 on Mac OS 10.10
|
54
|
-
|
52
|
+
* Tested and developed with Ruby 2.0.0, 2.1.2, 2.2.0 on Mac OS 10.10
|
53
|
+
* Tested against [Learning Photography](http://learning.photography)
|
54
|
+
* Requires >= Ruby 2.0.0
|
@@ -49,8 +49,8 @@ module ApplicationHelpers
|
|
49
49
|
DateTime.now.strftime('%Y-%m-%d')
|
50
50
|
end
|
51
51
|
|
52
|
-
def
|
53
|
-
num.to_i == 1 ? "#{num}
|
52
|
+
def pluralize(num, singular, plural)
|
53
|
+
num.to_i == 1 ? "#{num} #{singular.capitalize}" : "#{num} #{plural.capitalize}"
|
54
54
|
end
|
55
55
|
|
56
56
|
def strip_protocol(page)
|
@@ -70,6 +70,10 @@ module ApplicationHelpers
|
|
70
70
|
|
71
71
|
## Metrics Helpers
|
72
72
|
|
73
|
+
def max_hash_key_exclude_value(unsorted_hash, exclude_value)
|
74
|
+
unsorted_hash.sort_by{ |k, v| v }.map{ |k, v| [k, v] unless k.downcase == exclude_value }.compact.last
|
75
|
+
end
|
76
|
+
|
73
77
|
def display_as_currency(value)
|
74
78
|
ShopifyAPI::Shop.current.money_with_currency_format.gsub("{{amount}}", value.to_s)
|
75
79
|
rescue
|
@@ -69,9 +69,13 @@ module ShopifyDashboardPlus
|
|
69
69
|
def to_h
|
70
70
|
{
|
71
71
|
:currencies_per_sale => currencies_per_sale,
|
72
|
+
:most_used_currency => currencies_per_sale.sort_by{ |k, v| v }.last,
|
72
73
|
:sales_per_country => sales_per_country,
|
74
|
+
:most_sales_per_country => sales_per_country.sort_by{ |k, v| v }.last,
|
73
75
|
:sales_per_price => sales_per_price_point,
|
76
|
+
:top_selling_price_point => sales_per_price_point.sort_by{ |k, v| v }.last,
|
74
77
|
:sales_per_product => sales_per_product,
|
78
|
+
:top_selling_product => sales_per_product.sort_by{ |k, v| v }.last,
|
75
79
|
:sales_per_customer => sales_per_customer,
|
76
80
|
:number_of_sales => number_of_sales
|
77
81
|
}
|
@@ -111,7 +115,9 @@ module ShopifyDashboardPlus
|
|
111
115
|
{
|
112
116
|
:revenue_per_country => revenue_per_country,
|
113
117
|
:revenue_per_product => revenue_per_product,
|
118
|
+
:top_grossing_product => revenue_per_product.sort_by{ |k, v| v }.last,
|
114
119
|
:revenue_per_price_point => revenue_per_price_point,
|
120
|
+
:top_grossing_price_point => revenue_per_price_point.sort_by{ |k, v| v}.last
|
115
121
|
}
|
116
122
|
end
|
117
123
|
end
|
@@ -132,7 +138,9 @@ module ShopifyDashboardPlus
|
|
132
138
|
end
|
133
139
|
{
|
134
140
|
:discount_savings => discount_value,
|
135
|
-
:
|
141
|
+
:top_discount_savings => discount_value.sort_by{ |k, v| v }.last,
|
142
|
+
:discount_quantity => discount_used,
|
143
|
+
:most_used_discount_code => discount_used.sort_by{ |k, v| v }.last
|
136
144
|
}
|
137
145
|
end
|
138
146
|
|
@@ -159,8 +167,10 @@ module ShopifyDashboardPlus
|
|
159
167
|
end
|
160
168
|
end
|
161
169
|
{
|
162
|
-
:referral_sites =>
|
163
|
-
:
|
170
|
+
:referral_sites => referring_sites.sort().to_h,
|
171
|
+
:top_referral_site => max_hash_key_exclude_value(referring_sites, 'none'),
|
172
|
+
:referral_pages => referring_pages.sort().to_h,
|
173
|
+
:top_referral_page => max_hash_key_exclude_value(referring_pages, 'none')
|
164
174
|
}
|
165
175
|
end
|
166
176
|
|
@@ -181,8 +191,10 @@ module ShopifyDashboardPlus
|
|
181
191
|
end
|
182
192
|
end
|
183
193
|
{
|
184
|
-
:revenue_per_referral_site =>
|
185
|
-
:
|
194
|
+
:revenue_per_referral_site => revenue_per_referral_site.sort().to_h,
|
195
|
+
:top_referral_site_revenue => max_hash_key_exclude_value(revenue_per_referral_site, 'none'),
|
196
|
+
:revenue_per_referral_page => revenue_per_referral_page.sort().to_h,
|
197
|
+
:top_referral_page_revenue => max_hash_key_exclude_value(revenue_per_referral_page, 'none')
|
186
198
|
}
|
187
199
|
end
|
188
200
|
|
data/public/css/common.css
CHANGED
data/views/report.erb
CHANGED
@@ -27,10 +27,11 @@
|
|
27
27
|
</h4>
|
28
28
|
<hr class="graph-seperator">
|
29
29
|
<%= column_chart @metrics[:daily_revenue], library: {hAxis: {direction: -1}} %>
|
30
|
+
<hr class="graph-seperator">
|
30
31
|
<div class="graph-metrics">
|
31
32
|
<div class="graph-metric">
|
32
33
|
<h5 class="grey">Duration</h5>
|
33
|
-
<h3 class="money"><%=
|
34
|
+
<h3 class="money"><%= pluralize @metrics[:duration], "day", "days" %></h3>
|
34
35
|
</div>
|
35
36
|
<div class="graph-metric">
|
36
37
|
<h5 class="grey">Number of Sales</h5>
|
@@ -65,6 +66,15 @@
|
|
65
66
|
</h4>
|
66
67
|
<hr class="graph-seperator">
|
67
68
|
<%= column_chart @metrics[:sales_per_product] %>
|
69
|
+
<% if @metrics[:top_selling_product] %>
|
70
|
+
<hr class="graph-seperator">
|
71
|
+
<div class="graph-metrics">
|
72
|
+
<div class="graph-metric">
|
73
|
+
<h5 class="grey">Best Selling Product</h5>
|
74
|
+
<h4 class="stats"><%= @metrics[:top_selling_product][0] %> : <b><%= pluralize @metrics[:top_selling_product][1], "Sale", "Sales" %></b></h4>
|
75
|
+
</div>
|
76
|
+
</div>
|
77
|
+
<% end %>
|
68
78
|
</div>
|
69
79
|
|
70
80
|
<div class="graph-border">
|
@@ -73,6 +83,15 @@
|
|
73
83
|
</h4>
|
74
84
|
<hr class="graph-seperator">
|
75
85
|
<%= column_chart @metrics[:revenue_per_product] %>
|
86
|
+
<% if @metrics[:top_grossing_product] %>
|
87
|
+
<hr class="graph-seperator">
|
88
|
+
<div class="graph-metrics">
|
89
|
+
<div class="graph-metric">
|
90
|
+
<h5 class="grey">Most Profitable Product</h5>
|
91
|
+
<h4 class="stats"><%= @metrics[:top_grossing_product][0] %> : <b><%= display_as_currency @metrics[:top_grossing_product][1] %></b></h4>
|
92
|
+
</div>
|
93
|
+
</div>
|
94
|
+
<% end %>
|
76
95
|
</div>
|
77
96
|
</div>
|
78
97
|
|
@@ -93,6 +112,15 @@
|
|
93
112
|
</h4>
|
94
113
|
<hr class="graph-seperator">
|
95
114
|
<%= column_chart @metrics[:sales_per_price] %>
|
115
|
+
<% if @metrics[:top_selling_price_point] %>
|
116
|
+
<hr class="graph-seperator">
|
117
|
+
<div class="graph-metrics">
|
118
|
+
<div class="graph-metric">
|
119
|
+
<h5 class="grey">Top Selling Price Point</h5>
|
120
|
+
<h4 class="stats"><b><%= @metrics[:top_selling_price_point][0] %></b> : <%= pluralize @metrics[:top_selling_price_point][1], "Sale", "Sales" %></h4>
|
121
|
+
</div>
|
122
|
+
</div>
|
123
|
+
<% end %>
|
96
124
|
</div>
|
97
125
|
|
98
126
|
<div class="graph-border">
|
@@ -101,6 +129,15 @@
|
|
101
129
|
</h4>
|
102
130
|
<hr class="graph-seperator">
|
103
131
|
<%= column_chart @metrics[:revenue_per_price_point] %>
|
132
|
+
<% if @metrics[:top_grossing_price_point] %>
|
133
|
+
<hr class="graph-seperator">
|
134
|
+
<div class="graph-metrics">
|
135
|
+
<div class="graph-metric">
|
136
|
+
<h5 class="grey">Top Grossing Price Point</h5>
|
137
|
+
<h4 class="stats"><b><%= @metrics[:top_grossing_price_point][0] %></b> : <%= display_as_currency @metrics[:top_grossing_price_point][1] %></h4>
|
138
|
+
</div>
|
139
|
+
</div>
|
140
|
+
<% end %>
|
104
141
|
</div>
|
105
142
|
|
106
143
|
<div class="graph-border">
|
@@ -109,6 +146,15 @@
|
|
109
146
|
</h4>
|
110
147
|
<hr class="graph-seperator">
|
111
148
|
<%= column_chart @metrics[:discount_savings] %>
|
149
|
+
<% if @metrics[:top_discount_savings] %>
|
150
|
+
<hr class="graph-seperator">
|
151
|
+
<div class="graph-metrics">
|
152
|
+
<div class="graph-metric">
|
153
|
+
<h5 class="grey">Greatest Value Redeemed per Discount Code</h5>
|
154
|
+
<h4 class="stats"><%= @metrics[:top_discount_savings][0] %> : <b><%= display_as_currency @metrics[:top_discount_savings][1] %></b></h4>
|
155
|
+
</div>
|
156
|
+
</div>
|
157
|
+
<% end %>
|
112
158
|
</div>
|
113
159
|
|
114
160
|
<div class="graph-border">
|
@@ -117,6 +163,15 @@
|
|
117
163
|
</h4>
|
118
164
|
<hr class="graph-seperator">
|
119
165
|
<%= column_chart @metrics[:discount_quantity] %>
|
166
|
+
<% if @metrics[:most_used_discount_code] %>
|
167
|
+
<hr class="graph-seperator">
|
168
|
+
<div class="graph-metrics">
|
169
|
+
<div class="graph-metric">
|
170
|
+
<h5 class="grey">Most Used Discount Code</h5>
|
171
|
+
<h4 class="stats"><%= @metrics[:most_used_discount_code][0] %> : <b><%= pluralize @metrics[:most_used_discount_code][1], "Time", "Times" %></b></h4>
|
172
|
+
</div>
|
173
|
+
</div>
|
174
|
+
<% end %>
|
120
175
|
</div>
|
121
176
|
</div>
|
122
177
|
|
@@ -129,6 +184,15 @@
|
|
129
184
|
</h4>
|
130
185
|
<hr class="graph-seperator">
|
131
186
|
<%= pie_chart @metrics[:sales_per_country] %>
|
187
|
+
<% if @metrics[:most_sales_per_country] %>
|
188
|
+
<hr class="graph-seperator">
|
189
|
+
<div class="graph-metrics">
|
190
|
+
<div class="graph-metric">
|
191
|
+
<h5 class="grey">Most Sales Per Country</h5>
|
192
|
+
<h4 class="stats"><%= @metrics[:most_sales_per_country][0] %> : <b><%= pluralize @metrics[:most_sales_per_country][1], "Time", "Times"%></b></h4>
|
193
|
+
</div>
|
194
|
+
</div>
|
195
|
+
<% end %>
|
132
196
|
</div>
|
133
197
|
|
134
198
|
<div class="graph-border">
|
@@ -149,6 +213,15 @@
|
|
149
213
|
</h4>
|
150
214
|
<hr class="graph-seperator">
|
151
215
|
<%= pie_chart @metrics[:currencies_per_sale] %>
|
216
|
+
<% if @metrics[:most_used_currency] %>
|
217
|
+
<hr class="graph-seperator">
|
218
|
+
<div class="graph-metrics">
|
219
|
+
<div class="graph-metric">
|
220
|
+
<h5 class="grey">Most Used Currency</h5>
|
221
|
+
<h4 class="stats"><%= @metrics[:most_used_currency][0] %> : <b><%= pluralize @metrics[:most_used_currency][1], "Time", "Times" %></b></h4>
|
222
|
+
</div>
|
223
|
+
</div>
|
224
|
+
<% end %>
|
152
225
|
</div>
|
153
226
|
</div>
|
154
227
|
|
@@ -173,6 +246,15 @@
|
|
173
246
|
</h4>
|
174
247
|
<hr class="graph-seperator">
|
175
248
|
<%= column_chart @metrics[:referral_sites] %>
|
249
|
+
<% if @metrics[:top_referral_site] %>
|
250
|
+
<hr class="graph-seperator">
|
251
|
+
<div class="graph-metrics">
|
252
|
+
<div class="graph-metric">
|
253
|
+
<h5 class="grey">Top Referral Site</h5>
|
254
|
+
<h4 class="stats"><b><%= @metrics[:top_referral_site][0] %></b> : <%= pluralize @metrics[:top_referral_site][1], "Referral", "Referrals" %></h4>
|
255
|
+
</div>
|
256
|
+
</div>
|
257
|
+
<% end %>
|
176
258
|
</div>
|
177
259
|
|
178
260
|
<div class="graph-border">
|
@@ -181,6 +263,15 @@
|
|
181
263
|
</h4>
|
182
264
|
<hr class="graph-seperator">
|
183
265
|
<%= column_chart @metrics[:referral_pages] %>
|
266
|
+
<% if @metrics[:top_referral_page] %>
|
267
|
+
<hr class="graph-seperator">
|
268
|
+
<div class="graph-metrics">
|
269
|
+
<div class="graph-metric">
|
270
|
+
<h5 class="grey">Top Referral Page</h5>
|
271
|
+
<h4 class="stats"><b><%= @metrics[:top_referral_page][0] %></b> : <%= pluralize @metrics[:top_referral_page][1], "Referral", "Referrals" %></h4>
|
272
|
+
</div>
|
273
|
+
</div>
|
274
|
+
<% end %>
|
184
275
|
</div>
|
185
276
|
|
186
277
|
<div class="graph-border">
|
@@ -189,6 +280,15 @@
|
|
189
280
|
</h4>
|
190
281
|
<hr class="graph-seperator">
|
191
282
|
<%= column_chart @metrics[:revenue_per_referral_site] %>
|
283
|
+
<% if @metrics[:top_referral_site_revenue] %>
|
284
|
+
<hr class="graph-seperator">
|
285
|
+
<div class="graph-metrics">
|
286
|
+
<div class="graph-metric">
|
287
|
+
<h5 class="grey">Highest Revenue per Referral Site</h5>
|
288
|
+
<h4 class="stats"><b><%= @metrics[:top_referral_site_revenue][0] %></b> : <%= display_as_currency @metrics[:top_referral_site_revenue][1] %></h4>
|
289
|
+
</div>
|
290
|
+
</div>
|
291
|
+
<% end %>
|
192
292
|
</div>
|
193
293
|
|
194
294
|
<div class="graph-border">
|
@@ -197,6 +297,15 @@
|
|
197
297
|
</h4>
|
198
298
|
<hr class="graph-seperator">
|
199
299
|
<%= column_chart @metrics[:revenue_per_referral_page] %>
|
300
|
+
<% if @metrics[:top_referral_page_revenue] %>
|
301
|
+
<hr class="graph-seperator">
|
302
|
+
<div class="graph-metrics">
|
303
|
+
<div class="graph-metric">
|
304
|
+
<h5 class="grey">Highest Revenue per Referral Page</h5>
|
305
|
+
<h4 class="stats"><b><%= @metrics[:top_referral_page_revenue][0] %></b> : <%= display_as_currency @metrics[:top_referral_page_revenue][1] %></h4>
|
306
|
+
</div>
|
307
|
+
</div>
|
308
|
+
<% end %>
|
200
309
|
</div>
|
201
310
|
</div>
|
202
311
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shopify_dashboard_plus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Willems
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-06-
|
11
|
+
date: 2015-06-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|