yandex-metrika-rails 0.1.1 → 0.1.2
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/README.md
CHANGED
@@ -40,6 +40,16 @@ Or synchronously...
|
|
40
40
|
|
41
41
|
= metrika_init(async: false)
|
42
42
|
|
43
|
+
#### Available settings:
|
44
|
+
|
45
|
+
= metrika_init(async: false, clickmap: true, noscript: false)
|
46
|
+
|
47
|
+
`webvisor` : WebVisor
|
48
|
+
`clickmap` : Click map
|
49
|
+
`trackLinks` : External links, file downloads and "Share" button report
|
50
|
+
`trackHash` : Hash tracking in the browser address window
|
51
|
+
`accurateTrackBounce` : Accurate bounce rate
|
52
|
+
`noscript` : Show `noscript` tag at the page. `true` by default.
|
43
53
|
|
44
54
|
## Contributing
|
45
55
|
|
@@ -28,7 +28,8 @@ module YandexMetrika
|
|
28
28
|
def template_options
|
29
29
|
TemplateOptions.new({
|
30
30
|
counter_name: "yaCounter#{YM.counter}",
|
31
|
-
counter_options: @options_renderer.to_s
|
31
|
+
counter_options: @options_renderer.to_s,
|
32
|
+
noscript: @noscript
|
32
33
|
})
|
33
34
|
end
|
34
35
|
|
@@ -36,7 +37,8 @@ module YandexMetrika
|
|
36
37
|
@local = args.delete(:local) || false
|
37
38
|
@async = true
|
38
39
|
@async = args.delete(:async) if args.include? :async
|
39
|
-
@noscript =
|
40
|
+
@noscript = true
|
41
|
+
@noscript = args.delete(:noscript) if args.include? :noscript
|
40
42
|
end
|
41
43
|
|
42
44
|
def append_counter_types(args = {})
|
@@ -17,4 +17,6 @@
|
|
17
17
|
} else { f(); }
|
18
18
|
})(document, window, "yandex_metrika_callbacks");
|
19
19
|
</script>
|
20
|
-
|
20
|
+
<% if noscript %>
|
21
|
+
<noscript><div><img src="//mc.yandex.ru/watch/<%= counter %>" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
|
22
|
+
<% end %>
|
@@ -3,4 +3,6 @@
|
|
3
3
|
try { var <%= counter_name %> = new Ya.Metrika(<%= counter_options %>);
|
4
4
|
} catch(e) { }
|
5
5
|
</script>
|
6
|
-
|
6
|
+
<% if noscript %>
|
7
|
+
<noscript><div><img src="//mc.yandex.ru/watch/<%= counter %>" style="position:absolute; left:-9999px;" alt="" /></div></noscript>
|
8
|
+
<% end %>
|
@@ -19,6 +19,11 @@ class ViewHelpersTest < TestCase
|
|
19
19
|
assert_match %r{\<\/noscript\>}, metrika_init_script
|
20
20
|
end
|
21
21
|
|
22
|
+
def test_metrica_should_not_have_noscript_tag
|
23
|
+
metrika_init_script = metrika_init(noscript: false)
|
24
|
+
refute_match %r{\<\/noscript\>}, metrika_init_script
|
25
|
+
end
|
26
|
+
|
22
27
|
def test_metrica_should_have_webvisor
|
23
28
|
metrika_init_script = metrika_init(webvisor: true)
|
24
29
|
assert_match %r{webvisor:true}, metrika_init_script
|