asyncomni 0.0.3 → 0.0.4
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.
- checksums.yaml +4 -4
- data/README.md +12 -5
- data/app/assets/javascripts/asyncomni.js +3 -0
- data/app/helpers/omniture_helper.rb +6 -0
- data/app/models/omniture.rb +5 -1
- data/app/views/omniture/_send_to_omniture.haml +1 -2
- data/config/initializers/omniture.rb +1 -1
- data/config/omniture.yml +3 -0
- data/lib/asyncomni/version.rb +1 -1
- data/lib/generators/asyncomni/install/install_generator.rb +1 -1
- data/spec/dummy/config/omniture.yml +3 -0
- data/spec/dummy/log/test.log +50 -0
- data/spec/helpers/omniture_helper_spec.rb +6 -0
- data/spec/models/omniture_spec.rb +21 -0
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4c0267ec473e579e15a2838de53887d9e0dfa99
|
4
|
+
data.tar.gz: 96a295a7c94a17dbfc5017a112e9dbc6cb4b95fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4baa1f03db43db3ce612860d2a1614a161d8185b03812c37107df6e9e4f4d83cccd1b2fc0a3c353a4fc584887975e2df3445cda50abf4b24f0e4e086ac29002b
|
7
|
+
data.tar.gz: 2ae7f0ea5ff4e6087c21f0859cb288bb3a8edae7bc3aa2266bf5081e7127a1167102dfcf29174d84c19307f3d4bb921ff0cb941c5f50f7ca4837dc271bccdaaf
|
data/README.md
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
# Asyncomni
|
2
2
|
|
3
|
-
Omniture integration could be painful in rails application. This project uses simple concept of using iframe to make asynchronus calls (not ajax!) to omniture to send usage tracking information.
|
3
|
+
Omniture integration(https://sitecatalyst.omniture.com) could be painful in rails application. This project uses simple concept of using iframe to make asynchronus calls (not ajax!) to omniture to send usage tracking information.
|
4
4
|
|
5
5
|
##Pre-requisites:
|
6
6
|
|
7
|
-
For Rails 3+ Applications.
|
7
|
+
For Rails 3.2+ and now supports Rails 4 Applications.
|
8
8
|
|
9
9
|
##Installling
|
10
10
|
|
@@ -26,13 +26,20 @@ This will create some file for you.
|
|
26
26
|
|
27
27
|
create config/omniture.yml
|
28
28
|
route resources :omniture, :only => [:index]
|
29
|
-
create app/views/
|
29
|
+
create app/views/omniture/_omniture.html.erb
|
30
30
|
append app/views/layouts/application.html.erb
|
31
31
|
|
32
|
-
Also require `
|
32
|
+
Also require `asyncomni.js` is your `application.js`
|
33
33
|
|
34
|
-
= require '
|
34
|
+
= require 'asyncomni'
|
35
35
|
|
36
|
+
By default Omniture is enabled in all Environments, if you wish to turn it off in `development` or other staging environments you can disable it in `Omniture.yml`
|
37
|
+
|
38
|
+
development:
|
39
|
+
account: 'devdemoapp'
|
40
|
+
enabled: false
|
41
|
+
<<: *defaults
|
42
|
+
|
36
43
|
That's it! :pray:
|
37
44
|
|
38
45
|
**Note**
|
@@ -25,6 +25,12 @@ module OmnitureHelper
|
|
25
25
|
end
|
26
26
|
end
|
27
27
|
|
28
|
+
def asyncomni_content_tag
|
29
|
+
if Omniture.enabled?
|
30
|
+
tag(:iframe, id: 'omnitureFrame', name: 'omnitureFrame', width: '0', height: '0', style: 'visibility:hidden', data: {'page-name' => page_name, 'omniture-url' => omniture_url })
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
28
34
|
def page_name
|
29
35
|
name = []
|
30
36
|
name << application_name
|
data/app/models/omniture.rb
CHANGED
@@ -13,7 +13,11 @@ class Omniture
|
|
13
13
|
end
|
14
14
|
|
15
15
|
class << self
|
16
|
-
attr_accessor :sprop_mappings, :application_name, :tracking_account
|
16
|
+
attr_accessor :sprop_mappings, :application_name, :tracking_account, :enabled
|
17
|
+
|
18
|
+
def enabled?
|
19
|
+
enabled
|
20
|
+
end
|
17
21
|
|
18
22
|
def sprop_for property
|
19
23
|
sprop = sprop_mappings[property]
|
@@ -1,13 +1,12 @@
|
|
1
1
|
%script{:language => "JavaScript"}
|
2
2
|
s_account="#{Omniture.tracking_account}";
|
3
|
-
= javascript_include_tag '
|
3
|
+
= javascript_include_tag 'application'
|
4
4
|
%script{:language => "JavaScript"}
|
5
5
|
s.pageName=parent.document.getElementById('omnitureFrame').attributes.getNamedItem('data-page-name').value;
|
6
6
|
s.#{Omniture.sprop_for('user_id')}='#{user_id}';
|
7
7
|
s.#{Omniture.sprop_for('site_name')}='#{application_name}';
|
8
8
|
s.#{Omniture.sprop_for('session_id')}='#{request.session_options[:id]}';
|
9
9
|
s.#{Omniture.sprop_for('timestamp')}='#{omniture_formatted_time}';
|
10
|
-
%script{:language => "JavaScript"}
|
11
10
|
/
|
12
11
|
\/************* DO NOT ALTER ANYTHING BELOW THIS LINE ! **************/
|
13
12
|
var s_code=s.t();if(s_code)document.write(s_code);if(navigator.appVersion.indexOf('MSIE')>=0)document.write(unescape('%3C')+'\!-'+'-');
|
@@ -1,7 +1,7 @@
|
|
1
1
|
if File.exists?("#{Rails.root}/config/omniture.yml")
|
2
2
|
omniture_config = YAML.load_file("#{Rails.root}/config/omniture.yml")[Rails.env]
|
3
|
-
|
4
3
|
Omniture.tracking_account = omniture_config["account"]
|
5
4
|
Omniture.application_name = omniture_config["application_name"]
|
6
5
|
Omniture.sprop_mappings = omniture_config["sprop_mappings"]
|
6
|
+
Omniture.enabled = omniture_config["enabled"]
|
7
7
|
end
|
data/config/omniture.yml
CHANGED
@@ -9,10 +9,13 @@ defaults: &defaults
|
|
9
9
|
timestamp: 'prop98'
|
10
10
|
production:
|
11
11
|
account: 'proddemoapp'
|
12
|
+
enabled: true
|
12
13
|
<<: *defaults
|
13
14
|
development:
|
14
15
|
account: 'devdemoapp'
|
16
|
+
enabled: true
|
15
17
|
<<: *defaults
|
16
18
|
test:
|
17
19
|
account: 'testdemoapp'
|
20
|
+
enabled: false
|
18
21
|
<<: *defaults
|
data/lib/asyncomni/version.rb
CHANGED
@@ -19,7 +19,7 @@ module Asyncomni
|
|
19
19
|
desc "This Generator is to create omniture partial"
|
20
20
|
def create_omniture_partial
|
21
21
|
create_file "app/views/omniture/_omniture.html.erb", <<-FILE
|
22
|
-
<%=
|
22
|
+
<%= asyncomni_content_tag %>
|
23
23
|
FILE
|
24
24
|
end
|
25
25
|
|
@@ -9,10 +9,13 @@ defaults: &defaults
|
|
9
9
|
timestamp: 'prop98'
|
10
10
|
production:
|
11
11
|
account: 'proddemoapp'
|
12
|
+
enabled: true
|
12
13
|
<<: *defaults
|
13
14
|
development:
|
14
15
|
account: 'devdemoapp'
|
16
|
+
enabled: true
|
15
17
|
<<: *defaults
|
16
18
|
test:
|
17
19
|
account: 'testdemoapp'
|
20
|
+
enabled: true
|
18
21
|
<<: *defaults
|
data/spec/dummy/log/test.log
CHANGED
@@ -49,3 +49,53 @@ Completed 200 OK in 31ms (Views: 30.5ms | ActiveRecord: 0.0ms)
|
|
49
49
|
[1m[35m (0.0ms)[0m rollback transaction
|
50
50
|
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
51
51
|
[1m[35m (0.0ms)[0m rollback transaction
|
52
|
+
[1m[36m (0.4ms)[0m [1mbegin transaction[0m
|
53
|
+
Processing by OmnitureController#index as HTML
|
54
|
+
Rendered /Users/gouravtiwari/rubyapps/asyncomni/app/views/omniture/_send_to_omniture.haml (1.0ms)
|
55
|
+
Completed 200 OK in 9ms (Views: 8.2ms | ActiveRecord: 0.0ms)
|
56
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
57
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
58
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
59
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
60
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
61
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
62
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
63
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
64
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
65
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
66
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
67
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
68
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
69
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
70
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
71
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
72
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
73
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
74
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
75
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
76
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
77
|
+
[1m[36m (0.2ms)[0m [1mbegin transaction[0m
|
78
|
+
Processing by OmnitureController#index as HTML
|
79
|
+
Rendered /Users/gouravtiwari/rubyapps/asyncomni/app/views/omniture/_send_to_omniture.haml (0.6ms)
|
80
|
+
Completed 200 OK in 6ms (Views: 5.6ms | ActiveRecord: 0.0ms)
|
81
|
+
[1m[35m (0.1ms)[0m rollback transaction
|
82
|
+
[1m[36m (0.1ms)[0m [1mbegin transaction[0m
|
83
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
84
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
85
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
86
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
87
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
88
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
89
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
90
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
91
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
92
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
93
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
94
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
95
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
96
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
97
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
98
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
99
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
100
|
+
[1m[36m (0.0ms)[0m [1mbegin transaction[0m
|
101
|
+
[1m[35m (0.0ms)[0m rollback transaction
|
@@ -31,4 +31,10 @@ describe OmnitureHelper do
|
|
31
31
|
it "should have omniture formatted time" do
|
32
32
|
helper.omniture_formatted_time.should == Time.now.strftime('%m/%d/%Y %I:%M:%S %p')
|
33
33
|
end
|
34
|
+
|
35
|
+
it "should have the content tag for omniture footer" do
|
36
|
+
controller.stub(:controller_name).and_return('widgets')
|
37
|
+
controller.stub(:action_name).and_return('index')
|
38
|
+
helper.asyncomni_content_tag.should == "<iframe data-omniture-url=\"http://test.host/omniture?page_name=demo-app_Widgets_Index&user_id=unknown&application_name=demo-app\" data-page-name=\"demo-app_Widgets_Index\" height=\"0\" id=\"omnitureFrame\" name=\"omnitureFrame\" style=\"visibility:hidden\" width=\"0\" />"
|
39
|
+
end
|
34
40
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Omniture do
|
4
|
+
|
5
|
+
it "should respond to enabled?" do
|
6
|
+
Omniture.enabled?.should be_true
|
7
|
+
end
|
8
|
+
|
9
|
+
it "should respond to sprop_mappings" do
|
10
|
+
Omniture.sprop_mappings['user_id'].should eq('prop12')
|
11
|
+
Omniture.sprop_mappings['page_name'].should eq('prop82')
|
12
|
+
Omniture.sprop_mappings['site_name'].should eq('prop26')
|
13
|
+
Omniture.sprop_mappings['session_id'].should eq('prop37')
|
14
|
+
end
|
15
|
+
|
16
|
+
it "should respond to application_name" do
|
17
|
+
Omniture.application_name.should eq('demo-app')
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: asyncomni
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gourav Tiwari
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -74,6 +74,7 @@ executables: []
|
|
74
74
|
extensions: []
|
75
75
|
extra_rdoc_files: []
|
76
76
|
files:
|
77
|
+
- app/assets/javascripts/asyncomni.js
|
77
78
|
- app/assets/javascripts/omniture.js
|
78
79
|
- app/assets/javascripts/s_code.js
|
79
80
|
- app/controllers/omniture_controller.rb
|
@@ -150,6 +151,7 @@ files:
|
|
150
151
|
- spec/dummy/README.rdoc
|
151
152
|
- spec/dummy/script/rails
|
152
153
|
- spec/helpers/omniture_helper_spec.rb
|
154
|
+
- spec/models/omniture_spec.rb
|
153
155
|
- spec/spec_helper.rb
|
154
156
|
homepage: https://github.com/gouravtiwari/asyncomni
|
155
157
|
licenses:
|
@@ -237,4 +239,5 @@ test_files:
|
|
237
239
|
- spec/dummy/README.rdoc
|
238
240
|
- spec/dummy/script/rails
|
239
241
|
- spec/helpers/omniture_helper_spec.rb
|
242
|
+
- spec/models/omniture_spec.rb
|
240
243
|
- spec/spec_helper.rb
|