Class: Analytical::Modules::Console
- Inherits:
-
Object
- Object
- Analytical::Modules::Console
show all
- Includes:
- Base
- Defined in:
- lib/analytical/modules/console.rb
Constant Summary
collapse
- CONSOLE_JS_ESCAPE_MAP =
{
'\\' => '\\\\',
'</' => '<\/',
"\r\n" => '\n',
"\n" => '\n',
"\r" => '\n',
'"' => '\\"',
"'" => "\\'"
}
Instance Attribute Summary
Attributes included from Base
#command_store, #initialized, #options, #tracking_command_location
Instance Method Summary
collapse
Methods included from Base
#init_location, #init_location?, #process_queued_commands, #protocol, #queue
Constructor Details
#initialize(options = {}) ⇒ Console
Returns a new instance of Console.
6
7
8
9
|
# File 'lib/analytical/modules/console.rb', line 6
def initialize(options={})
super
@tracking_command_location = :body_append
end
|
Instance Method Details
#alias_identity(old_identity, new_identity) ⇒ Object
54
55
56
57
58
|
# File 'lib/analytical/modules/console.rb', line 54
def alias_identity(old_identity,new_identity)
check_for_console " console.log(\"Analytical Alias: \#{old_identity} => \#{new_identity}\");\n HERE\nend\n"
|
#event(name, *args) ⇒ Object
39
40
41
42
43
44
45
|
# File 'lib/analytical/modules/console.rb', line 39
def event(name, *args)
data = args.first || {}
check_for_console " console.log(\"Analytical Event: \"+\"\#{escape name}\");\n console.log(\#{data.to_json});\n HERE\nend\n"
|
#identify(id, *args) ⇒ Object
31
32
33
34
35
36
37
|
# File 'lib/analytical/modules/console.rb', line 31
def identify(id, *args)
data = args.first || {}
check_for_console " console.log(\"Analytical Identify: \"+\"\#{escape id}\");\n console.log(\#{data.to_json});\n HERE\nend\n"
|
#init_javascript(location) ⇒ Object
11
12
13
14
15
16
17
18
19
20
21
22
23
|
# File 'lib/analytical/modules/console.rb', line 11
def init_javascript(location)
init_location(location) do
js = " <!-- Analytical Init: Console -->\n <script type=\"text/javascript\">\n if(typeof(console) !== 'undefined' && console != null) {\n console.log('Analytical Init: Console');\n }\n </script>\n HTML\n js\n end\nend\n"
|
#set(data) ⇒ Object
47
48
49
50
51
52
|
# File 'lib/analytical/modules/console.rb', line 47
def set(data)
check_for_console " console.log(\"Analytical Set: \");\n console.log(\#{data.to_json});\n HERE\nend\n"
|
#track(*args) ⇒ Object
25
26
27
28
29
|
# File 'lib/analytical/modules/console.rb', line 25
def track(*args)
check_for_console " console.log(\"Analytical Track: \"+\"\#{escape args.first}\");\n HERE\nend\n"
|