optimize_ab 0.0.6 → 0.0.7
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/lib/optimize_ab/helpers.rb +14 -60
- data/lib/optimize_ab/version.rb +1 -1
- metadata +2 -2
data/lib/optimize_ab/helpers.rb
CHANGED
@@ -41,23 +41,16 @@ module Helpers
|
|
41
41
|
# <%= multi_end_section %>
|
42
42
|
# </h1>
|
43
43
|
#
|
44
|
+
# in HAML a link might be written as:
|
44
45
|
#
|
45
|
-
#
|
46
|
-
# ---------------------------------------
|
47
|
-
# The conversion script tracks visits to your conversion page and
|
48
|
-
# should be placed immediately before the closing </head> tag on
|
49
|
-
# your conversion page.
|
46
|
+
# = link_to (multi_begin_section('Headline') + "Welcome" + multi_end_section)
|
50
47
|
#
|
51
48
|
#
|
52
|
-
# OnClick Conversion
|
49
|
+
# OnClick Conversion
|
53
50
|
# ---------------------------------------
|
54
|
-
#
|
55
|
-
#
|
56
|
-
#
|
57
|
-
#
|
58
|
-
# Next, you'll need to add a snippet of text to the link or links
|
59
|
-
# that you want to track as a conversion. Let's say your link
|
60
|
-
# looks like this:
|
51
|
+
# You'll need to add a snippet of text to the link or links
|
52
|
+
# that you want to track as a conversion. Let's say your link
|
53
|
+
# looks like this:
|
61
54
|
#
|
62
55
|
# <a href="http://www.example.com/promotion">Featured Products</a>
|
63
56
|
#
|
@@ -100,6 +93,14 @@ module Helpers
|
|
100
93
|
var _gaq = _gaq || [];
|
101
94
|
_gaq.push(['gwo._setAccount', "#{ua}"]);
|
102
95
|
_gaq.push(['gwo._trackPageview', "#{pv}"]);
|
96
|
+
function doGoal(that) {
|
97
|
+
try {
|
98
|
+
_gaq.push(['gwo._trackPageview', "#{pv}"]);
|
99
|
+
setTimeout('document.location = "' + that.href + '"', 100)
|
100
|
+
}
|
101
|
+
catch(err){}
|
102
|
+
}
|
103
|
+
|
103
104
|
(function() {
|
104
105
|
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
105
106
|
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
@@ -127,51 +128,4 @@ module Helpers
|
|
127
128
|
HTML
|
128
129
|
return js.html_safe
|
129
130
|
end
|
130
|
-
|
131
|
-
|
132
|
-
######## Mutli-Conversion Script ########
|
133
|
-
|
134
|
-
def multi_converstion(ua, pv)
|
135
|
-
js = <<-HTML
|
136
|
-
<!-- Google Website Optimizer Tracking Script -->
|
137
|
-
<script type="text/javascript">
|
138
|
-
var _gaq = _gaq || [];
|
139
|
-
_gaq.push(['gwo._setAccount', "#{ua}"]);
|
140
|
-
_gaq.push(['gwo._trackPageview', "#{pv}"]);
|
141
|
-
(function() {
|
142
|
-
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
143
|
-
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
144
|
-
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
145
|
-
})();
|
146
|
-
</script>
|
147
|
-
<!-- End of Google Website Optimizer Tracking Script -->
|
148
|
-
HTML
|
149
|
-
return js.html_safe
|
150
|
-
end
|
151
|
-
|
152
|
-
######## OnClick Conversion Script ########
|
153
|
-
|
154
|
-
def multi_on_click_converstion(ua, pv)
|
155
|
-
js = <<-HTML
|
156
|
-
<!-- Google Website Optimizer Tracking Script -->
|
157
|
-
<script type="text/javascript">
|
158
|
-
var _gaq = _gaq || [];
|
159
|
-
_gaq.push(['gwo._setAccount', "#{ua}"]);
|
160
|
-
function doGoal(that) {
|
161
|
-
try {
|
162
|
-
_gaq.push(['gwo._trackPageview', "#{pv}"]);
|
163
|
-
setTimeout('document.location = "' + that.href + '"', 100)
|
164
|
-
}
|
165
|
-
catch(err){}
|
166
|
-
}
|
167
|
-
(function() {
|
168
|
-
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
169
|
-
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
170
|
-
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
171
|
-
})();
|
172
|
-
</script>
|
173
|
-
<!-- End of Google Website Optimizer Tracking Script -->
|
174
|
-
HTML
|
175
|
-
return js.html_safe
|
176
|
-
end
|
177
131
|
end
|
data/lib/optimize_ab/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: optimize_ab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.7
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03-
|
12
|
+
date: 2012-03-25 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: Gem to integrate Google Optimize into Rails App
|
15
15
|
email:
|