lytix 0.1.0 → 0.1.1

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.0
1
+ 0.1.1
@@ -0,0 +1,8 @@
1
+ class VestalVersionsGenerator < Rails::Generator::Base
2
+ def manifest
3
+ record do |m|
4
+ m.directory File.join('config', 'initializers')
5
+ m.template 'initializer.rb', File.join('config', 'initializers', 'google_analytics.rb')
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,112 @@
1
+ Lytix.configure do
2
+ # Define a single Google Analytics account as follows:
3
+ #
4
+ # account "UA-123456-1"
5
+ #
6
+ # By default, this will include the basic analytics snippet on each HTML page. The default
7
+ # snippet looks like:
8
+ #
9
+ # <script type="text/javascript">
10
+ # var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
11
+ # document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
12
+ # </script>
13
+ # <script type="text/javascript">
14
+ # try{
15
+ # var pageTracker = _gat._getTracker("UA-123456-1");
16
+ # pageTracker._trackPageview();
17
+ # } catch(err) {}</script>
18
+ #
19
+ # For finer control over the behavior of the defined page tracker, use the +tracker+ method in
20
+ # an +account+ block:
21
+ #
22
+ # account "UA-123456-1" do
23
+ # tracker do
24
+ # set_allow_linker(true)
25
+ # end
26
+ # end
27
+ #
28
+ # Doing so would change the analytics snippet as follows:
29
+ #
30
+ # var pageTracker = _gat._getTracker("UA-123456-1");
31
+ # pageTracker.setAllowLinker(true);
32
+ # pageTracker._trackPageview();
33
+ #
34
+ # Any method can be declared within the tracker block. The method name will be properly camelized
35
+ # and the arguments properly formatted for inclusion in the snippet.
36
+ #
37
+ # E-commerce tracking is available through the transaction block. Within the account block, a
38
+ # transaction block may look similar to:
39
+ #
40
+ # account "UA-123456-1" do
41
+ # transaction do |order|
42
+ # _add_trans(
43
+ # order.id.to_s,
44
+ # "My Store",
45
+ # order.total.to_s,
46
+ # order.tax.to_s,
47
+ # order.shipping.to_s,
48
+ # order.billing_address.city,
49
+ # order.billing_address.state,
50
+ # order.billing_address.country
51
+ # )
52
+ # order.line_items.each do |line_item|
53
+ # _add_item(
54
+ # order.id.to_s,
55
+ # line_item.product.sku,
56
+ # line_item.product.name,
57
+ # line_item.product.category,
58
+ # line_item.unit_price.to_s,
59
+ # line_item.quantity.to_s
60
+ # )
61
+ # end
62
+ # _track_trans
63
+ # end
64
+ # end
65
+ #
66
+ # The transaction block can accept any number of arguments. Passing values to the :transaction
67
+ # option when generating the analytics snippet will pass those values into the transaction block.
68
+ # For instance:
69
+ #
70
+ # google_analytics :transaction => @order
71
+ #
72
+ # may produce the following snippet:
73
+ #
74
+ # <script type="text/javascript">
75
+ # var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
76
+ # document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
77
+ # </script>
78
+ # <script type="text/javascript">
79
+ # try{
80
+ # var pageTracker = _gat._getTracker("UA-123456-1");
81
+ # pageTracker._trackPageview();
82
+ # pageTracker._addTrans("123", "My Store", "40.00", "2.40", "10.00", "Holland", "Michigan", "USA");
83
+ # pageTracker._addItem("123", "ABC", "Sweatshirt", "Orange", "20.00", "2");
84
+ # pageTracker1._trackTrans();
85
+ # } catch(err) {}</script>
86
+ #
87
+ # Multiple accounts may be defined separately:
88
+ #
89
+ # account "UA-123456-1"
90
+ # account "UA-654321-1"
91
+ #
92
+ # or together:
93
+ #
94
+ # account "UA-123456-1", "UA-654321-1"
95
+ #
96
+ # Accounts can also be given names for easy inclusion/exclusion on any given page:
97
+ #
98
+ # account :default => "UA-123456-1"
99
+ # account :client => "UA-654321-1"
100
+ #
101
+ # Inclusion and exclusion is controlled by the :only and :except options when generating the
102
+ # anlytics snippet:
103
+ #
104
+ # google_analytics :except => :client
105
+ #
106
+ # Naming accounts is not required to use the :only or :except options. The Google Analytics
107
+ # account key itself can be given. An array of values can also be given to either option.
108
+ #
109
+ # Lytix was designed to be flexible, easily allowing for feature additions to Google Analytics.
110
+ # For more information on valid snippet syntax, see:
111
+ # http://code.google.com/intl/en/apis/analytics/docs/tracking/gaTrackingOverview.html
112
+ end
@@ -5,3 +5,5 @@ module Lytix
5
5
  block.bind(Configuration).call
6
6
  end
7
7
  end
8
+
9
+ ActionController::Base.send(:include, Lytix::ControllerMethods)
@@ -26,11 +26,9 @@ module Lytix
26
26
 
27
27
  def insert_google_analytics
28
28
  if @google_analytics && request.format.html? && response.body.respond_to?(:sub!)
29
- response.body.sub!(/([ \t]*)<\/body>/i){ [($1 + @google_analytics.to_s), $&].reject(&:blank?).join($/) }
29
+ response.body.sub!(/([ \t]*)<\/body>/i){ [($1 + @google_analytics.to_s), $&].join($/) }
30
30
  end
31
31
  end
32
32
  end
33
33
  end
34
34
  end
35
-
36
- ActionController::Base.send(:include, Lytix::ControllerMethods)
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{lytix}
8
- s.version = "0.1.0"
8
+ s.version = "0.1.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Steve Richert"]
@@ -23,6 +23,8 @@ Gem::Specification.new do |s|
23
23
  "README.rdoc",
24
24
  "Rakefile",
25
25
  "VERSION",
26
+ "generators/google_analytics/google_analytics_generator.rb",
27
+ "generators/google_analytics/templates/initializer.rb",
26
28
  "init.rb",
27
29
  "lib/lytix.rb",
28
30
  "lib/lytix/account.rb",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lytix
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Richert
@@ -38,6 +38,8 @@ files:
38
38
  - README.rdoc
39
39
  - Rakefile
40
40
  - VERSION
41
+ - generators/google_analytics/google_analytics_generator.rb
42
+ - generators/google_analytics/templates/initializer.rb
41
43
  - init.rb
42
44
  - lib/lytix.rb
43
45
  - lib/lytix/account.rb