paid_up 0.9.16 → 0.10.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 38e75535ec9017f37c02b173d158f019fa7bd758
4
- data.tar.gz: ce3687c56beb1573386e14478b0a294c8cce8128
3
+ metadata.gz: 95bac418def0c433f42d41a8734234af61e625ad
4
+ data.tar.gz: f3ba573ea7eae964bb63bb6485744c43a991a05e
5
5
  SHA512:
6
- metadata.gz: 3a7d6138b0181ab19eedea1563659f142cb16ed325504fe4a0706c663a4216e0ced83c61b730302cc9eaa12ac04c2c220937a23f3fb676fb0f0125067b3cf2fa
7
- data.tar.gz: 8928f789a651a4b3a16c5022a28a58e0027fa55fbda7d14493e225541e09e5a170f07f71e050c8af84dc1407fac050ba386b74ec4281b1d99fc465fcfb115049
6
+ metadata.gz: 7c3d1b56959e2be42989cac80abc057d6674c218c6cb190ea42def9234728160fdf4262c2cf2ae3a52abdfd9d0bd1353d5cb0f2b95322e77c75215d4ff5bdb50
7
+ data.tar.gz: 7b874ab4a8e73347ba6f40faacfb2319df6bd058d47c3d1b40d2edd48853a5a75c778b6d61087797fceb59590d3b2659565016f2f5bca5d767673ba5f99ccac2
data/README.md CHANGED
@@ -11,6 +11,7 @@ Paid Up is a start-to-finish Stripe subscription engine. You set up the plans an
11
11
  * Authorization by CanCanCan
12
12
  * Subscription by Stripe
13
13
  * Roles by Rolify
14
+ * Uses Google Tag Manager for Google Analytics `dataLayer` object to provide e-commerce analytics.
14
15
  * Assumes you will be using some variety of Bootstrap, and designed to be quite responsive out of the box, but included views can be overridden with custom views.
15
16
 
16
17
  ## Installation
@@ -100,6 +101,16 @@ The resources referred to in your config will need to call `paid_for`, like this
100
101
  class Group < ActiveRecord::Base
101
102
  paid_for
102
103
  end
104
+
105
+ ### Enabling Google Analytics
106
+
107
+ In your layout view, include the following code snippet, which will only fire when a subscription is made.
108
+
109
+ This needs to go above your call to Google Tag Manager, so that the data in it is available to GTM.
110
+
111
+ = paid_up_google_analytics_data_layer
112
+
113
+ Doing this will populate the e-commerce data in Google Analytics, but you must also have that feature turned on.
103
114
 
104
115
  ### Upgrading
105
116
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.16
1
+ 0.10.0
@@ -17,6 +17,7 @@ module PaidUp
17
17
  # @plan set by #set_plan
18
18
  current_user.update_attribute(:coupon_code, params[:coupon_code])
19
19
  if current_user.subscribe_to_plan(@plan, params[:stripeToken])
20
+ subscription_id = current_user.stripe_data.subscriptions.first.id
20
21
  discount = current_user.stripe_data.discount
21
22
  if !discount.nil? && !discount.coupon.nil? && @plan.amount != 0
22
23
  orig_amount = @plan.amount
@@ -28,7 +29,16 @@ module PaidUp
28
29
  else
29
30
  money = @plan.money
30
31
  end
31
- flash[:paid_up_subscription] = money.dollars
32
+ flash[:paid_up_google_analytics_data] = {
33
+ transactionId: subscription_id,
34
+ transactionTotal: money.dollars,
35
+ transactionProducts: [
36
+ sku: @plan.stripe_id,
37
+ name: @plan.title,
38
+ price: @plan.money.dollars,
39
+ quantity: '1'
40
+ ]
41
+ }
32
42
  redirect_to(
33
43
  subscriptions_path,
34
44
  flash: {
@@ -13,5 +13,9 @@ module PaidUp
13
13
  end
14
14
  dates.join('&mdash;').html_safe
15
15
  end
16
+
17
+ def paid_up_google_analytics_data_layer
18
+ render partial: 'paid_up/layouts/google_analytics_data_layer'
19
+ end
16
20
  end
17
21
  end
@@ -0,0 +1,4 @@
1
+ - if flash[:paid_up_google_analytics_data].present?
2
+ :javascript
3
+ window.dataLayer = window.dataLayer || []
4
+ dataLayer.push(#{flash[:paid_up_google_analytics_data].to_json});
@@ -16,3 +16,4 @@
16
16
  %h3= :abilities.l
17
17
  = feature_abilities_table
18
18
  %p.hidden-print= icon_button_to 'info btn-lg', 'arrow-right', :switch_plans.l, paid_up.plans_path, method: :get
19
+
@@ -1,5 +1,5 @@
1
1
  {
2
2
  "result": {
3
- "covered_percent": 95.29
3
+ "covered_percent": 95.26
4
4
  }
5
5
  }
@@ -405,7 +405,7 @@
405
405
  47,
406
406
  null,
407
407
  1,
408
- 4701,
408
+ 4727,
409
409
  null,
410
410
  1,
411
411
  31,
@@ -535,7 +535,7 @@
535
535
  null,
536
536
  null,
537
537
  null,
538
- 44,
538
+ 45,
539
539
  null,
540
540
  null,
541
541
  320,
@@ -1350,6 +1350,10 @@
1350
1350
  4,
1351
1351
  null,
1352
1352
  null,
1353
+ 1,
1354
+ 0,
1355
+ null,
1356
+ null,
1353
1357
  null
1354
1358
  ],
1355
1359
  "/Users/karen/Gems/paid_up/app/helpers/paid_up/features_helper.rb": [
@@ -1773,6 +1777,28 @@
1773
1777
  13,
1774
1778
  13,
1775
1779
  13,
1780
+ 13,
1781
+ 13,
1782
+ 3,
1783
+ 3,
1784
+ 3,
1785
+ 3,
1786
+ 3,
1787
+ 3,
1788
+ null,
1789
+ 10,
1790
+ null,
1791
+ 13,
1792
+ null,
1793
+ null,
1794
+ null,
1795
+ null,
1796
+ null,
1797
+ null,
1798
+ null,
1799
+ null,
1800
+ null,
1801
+ 13,
1776
1802
  null,
1777
1803
  null,
1778
1804
  null,
@@ -2171,15 +2197,15 @@
2171
2197
  null,
2172
2198
  null,
2173
2199
  1,
2174
- 192,
2175
- 192,
2200
+ 221,
2201
+ 221,
2176
2202
  null,
2177
2203
  0,
2178
2204
  null,
2179
2205
  null,
2180
2206
  null,
2181
2207
  1,
2182
- 174,
2208
+ 197,
2183
2209
  null,
2184
2210
  null,
2185
2211
  1,
@@ -2187,8 +2213,8 @@
2187
2213
  null,
2188
2214
  null,
2189
2215
  1,
2190
- 188,
2191
- 188,
2216
+ 214,
2217
+ 214,
2192
2218
  null,
2193
2219
  0,
2194
2220
  null,
@@ -2201,7 +2227,7 @@
2201
2227
  2239,
2202
2228
  null,
2203
2229
  null,
2204
- 5,
2230
+ 6,
2205
2231
  null,
2206
2232
  null,
2207
2233
  null,
@@ -3161,6 +3187,6 @@
3161
3187
  null
3162
3188
  ]
3163
3189
  },
3164
- "timestamp": 1457049389
3190
+ "timestamp": 1458155056
3165
3191
  }
3166
3192
  }
data/paid_up.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: paid_up 0.9.16 ruby lib
5
+ # stub: paid_up 0.10.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "paid_up"
9
- s.version = "0.9.16"
9
+ s.version = "0.10.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Karen Lundgren"]
14
- s.date = "2016-03-15"
14
+ s.date = "2016-03-16"
15
15
  s.description = "Allows a model of your choosing (such as users) to subscribe to a plan, which enables features."
16
16
  s.email = "karen.e.lundgren@gmail.com"
17
17
  s.extra_rdoc_files = [
@@ -53,6 +53,7 @@ Gem::Specification.new do |s|
53
53
  "app/views/layouts/mailer.text.haml",
54
54
  "app/views/paid_up/features/_abilities_table.html.haml",
55
55
  "app/views/paid_up/features/_table.html.haml",
56
+ "app/views/paid_up/layouts/_google_analytics_data_layer.html.haml",
56
57
  "app/views/paid_up/plans/index.html.haml",
57
58
  "app/views/paid_up/subscription_mailer/payment_failed_email.html.haml",
58
59
  "app/views/paid_up/subscription_mailer/payment_failed_email.text.haml",
@@ -8,6 +8,7 @@
8
8
 
9
9
  = render_head_css
10
10
  = javascript_include_tag 'application'
11
+ = paid_up_google_analytics_data_layer
11
12
  = csrf_meta_tags
12
13
 
13
14
  %body
Binary file
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paid_up
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.16
4
+ version: 0.10.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karen Lundgren
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-15 00:00:00.000000000 Z
11
+ date: 2016-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -417,6 +417,7 @@ files:
417
417
  - app/views/layouts/mailer.text.haml
418
418
  - app/views/paid_up/features/_abilities_table.html.haml
419
419
  - app/views/paid_up/features/_table.html.haml
420
+ - app/views/paid_up/layouts/_google_analytics_data_layer.html.haml
420
421
  - app/views/paid_up/plans/index.html.haml
421
422
  - app/views/paid_up/subscription_mailer/payment_failed_email.html.haml
422
423
  - app/views/paid_up/subscription_mailer/payment_failed_email.text.haml