analytics_instrumentation 0.1.6 → 0.1.7

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: ff0321bb8effd93476013ff31e7aa07320119786
4
- data.tar.gz: ca34cd660ff84ca6b73c6c4776869223a18dcd33
3
+ metadata.gz: 4bea271aed1d40623309687d1c5409a24b4e2d00
4
+ data.tar.gz: 0f9ad89948c5a062398f83b23452ff43e3262762
5
5
  SHA512:
6
- metadata.gz: fdf6916c194864a4b422be5844304c80cd7c67d7df8e464035f7e19370b175c65fa5a6402e9e2eb256aebabd94dbaac238f419f5bd602b46128c38de4c5165df
7
- data.tar.gz: 5f3e519d10cb4eae86b5de47a9faec15ab51c28fc7af667024454f333963e49dc94cb8eb6f7382da8323712d47112d322ccc1187bd796ed45b6f12cd15923c59
6
+ metadata.gz: 33afaf3fb918d2e7f07a1e699fe769cf20fa7ca1a65c272fb729e6f24791648e5d81525c591a151f56f2abedfe46dcc52fecfa4175fa99ec380754cdc7f9a6ea
7
+ data.tar.gz: fc7c0688d541140d768087c8de261021b6c60c35c2006c420d2e309d7c13067f24cc8e7dca7590ea50f7050e2d1c63893dd2f40b2d09bd7f74e2c6eaaac4bb6c
data/README.rdoc CHANGED
@@ -8,6 +8,12 @@ or
8
8
 
9
9
  gem install 'analytics_instrumentation'
10
10
 
11
+ and then `include AnalyticsInstrumentation` in `ApplicationController`:
12
+
13
+ class ApplicationController < ActionController::Base
14
+ include AnalyticsInstrumentation
15
+ end
16
+
11
17
 
12
18
  == Usage
13
19
 
@@ -4,9 +4,11 @@ module AnalyticsAttribution
4
4
  attribution_data = {
5
5
  first_external_referrer: get_first_referrer,
6
6
  latest_external_referrer: get_latest_referrer,
7
- latest_utm: get_latest_utm
8
7
  }
9
8
 
9
+ attribution_data.merge! get_utm(:first)
10
+ attribution_data.merge! get_utm(:latest)
11
+
10
12
  # Persist
11
13
  attribution_data.each do |k,v|
12
14
  set_cookie k, v
@@ -32,7 +34,19 @@ module AnalyticsAttribution
32
34
  end
33
35
  end
34
36
 
35
- def get_latest_utm
37
+ def get_utm(which=:latest)
38
+ if which == :first
39
+ first = {
40
+ first_utm_name: get_cookie('first_utm_name'),
41
+ first_utm_source: get_cookie('first_utm_source'),
42
+ first_utm_medium: get_cookie('first_utm_medium'),
43
+ first_utm_term: get_cookie('first_utm_term'),
44
+ first_utm_content: get_cookie('first_utm_content')
45
+ }
46
+
47
+ return first if first.reject{|k,v| v.nil? }.any?
48
+ end
49
+
36
50
  name = params[:utm_campaign]
37
51
  source = params[:utm_source]
38
52
  medium = params[:utm_medium]
@@ -40,14 +54,20 @@ module AnalyticsAttribution
40
54
  content = params[:utm_content]
41
55
 
42
56
  if name.blank?
43
- get_cookie 'latest_utm'
57
+ {
58
+ latest_utm_name: get_cookie('latest_utm_name'),
59
+ latest_utm_source: get_cookie('latest_utm_source'),
60
+ latest_utm_medium: get_cookie('latest_utm_medium'),
61
+ latest_utm_term: get_cookie('latest_utm_term'),
62
+ latest_utm_content: get_cookie('latest_utm_content')
63
+ }
44
64
  else
45
65
  {
46
- name: name,
47
- source: source,
48
- medium: medium,
49
- term: term,
50
- content: content
66
+ latest_utm_name: name,
67
+ latest_utm_source: source,
68
+ latest_utm_medium: medium,
69
+ latest_utm_term: term,
70
+ latest_utm_content: content
51
71
  }
52
72
  end
53
73
  end
@@ -1,3 +1,3 @@
1
1
  module AnalyticsInstrumentation
2
- VERSION = "0.1.6"
2
+ VERSION = "0.1.7"
3
3
  end
@@ -1,3 +1,4 @@
1
- class ApplicationController < ActionController::Base
2
- include AnalyticsInstrumentation
3
- end
1
+ # DOn't do this any more, causes too many errors
2
+ # class ApplicationController < ActionController::Base
3
+ # include AnalyticsInstrumentation
4
+ # end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: analytics_instrumentation
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Feldstein
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-04-04 00:00:00.000000000 Z
12
+ date: 2015-05-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -144,7 +144,8 @@ homepage: https://github.com/jfeldstein/analytics_implementation
144
144
  licenses:
145
145
  - MIT
146
146
  metadata: {}
147
- post_install_message:
147
+ post_install_message: VERSION 0.1.7 introduces BREAKING CHANGES! You MUST include
148
+ AnalyticsInstrumentation in your ApplicationController, manually!
148
149
  rdoc_options: []
149
150
  require_paths:
150
151
  - lib