optimize_ab 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/optimize_ab/helpers.rb +29 -2
- data/lib/optimize_ab/version.rb +1 -1
- metadata +1 -1
data/lib/optimize_ab/helpers.rb
CHANGED
@@ -1,5 +1,32 @@
|
|
1
1
|
module Helpers
|
2
|
-
def
|
3
|
-
|
2
|
+
def ab_head
|
3
|
+
js = <<-HTML
|
4
|
+
<!-- Google Website Optimizer Control Script -->
|
5
|
+
<script>
|
6
|
+
function utmx_section(){}function utmx(){}
|
7
|
+
(function(){var k='3270946421',d=document,l=d.location,c=d.cookie;function f(n){
|
8
|
+
if(c){var i=c.indexOf(n+'=');if(i>-1){var j=c.indexOf(';',i);return escape(c.substring(i+n.
|
9
|
+
length+1,j<0?c.length:j))}}}var x=f('__utmx'),xx=f('__utmxx'),h=l.hash;
|
10
|
+
d.write('<sc'+'ript src="'+
|
11
|
+
'http'+(l.protocol=='https:'?'s://ssl':'://www')+'.google-analytics.com'
|
12
|
+
+'/siteopt.js?v=1&utmxkey='+k+'&utmx='+(x?x:'')+'&utmxx='+(xx?xx:'')+'&utmxtime='
|
13
|
+
+new Date().valueOf()+(h?'&utmxhash='+escape(h.substr(1)):'')+
|
14
|
+
'" type="text/javascript" charset="utf-8"></sc'+'ript>')})();
|
15
|
+
</script><script>utmx("url",'A/B');</script>
|
16
|
+
<!-- End of Google Website Optimizer Control Script -->
|
17
|
+
<!-- Google Website Optimizer Tracking Script -->
|
18
|
+
<script type="text/javascript">
|
19
|
+
var _gaq = _gaq || [];
|
20
|
+
_gaq.push(['gwo._setAccount', 'UA-29835325-2']);
|
21
|
+
_gaq.push(['gwo._trackPageview', '/3270946421/test']);
|
22
|
+
(function() {
|
23
|
+
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
24
|
+
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
25
|
+
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
26
|
+
})();
|
27
|
+
</script>
|
28
|
+
<!-- End of Google Website Optimizer Tracking Script -->
|
29
|
+
HTML
|
30
|
+
return js
|
4
31
|
end
|
5
32
|
end
|
data/lib/optimize_ab/version.rb
CHANGED