asyncomni 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 88daef4cbdf7ad84f4e03b112a9231a77b21fd15
4
- data.tar.gz: 8eb6575e1351bb6c7273878cf9c8ffa1e00cfca3
3
+ metadata.gz: e4c0267ec473e579e15a2838de53887d9e0dfa99
4
+ data.tar.gz: 96a295a7c94a17dbfc5017a112e9dbc6cb4b95fe
5
5
  SHA512:
6
- metadata.gz: 375fcebcb59e0c730a5c254e70d38d261293bee4a204213f36fe21e115a2d236c8064d735921047ef8a945dbfdb9b82e491bbcbfe89835dd931cf13e3395c0be
7
- data.tar.gz: 206d605a7e2709a9dc7cf442b9eb0409b618af902e3c2855fdaebe5c8f55fbeff7dd8dfe2361a836814ee0fb50b51fb161cbbed8e2314679f4ebd5a31904e7b5
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/layouts/_omniture.html.erb
29
+ create app/views/omniture/_omniture.html.erb
30
30
  append app/views/layouts/application.html.erb
31
31
 
32
- Also require `omniture.js` is your `application.js`
32
+ Also require `asyncomni.js` is your `application.js`
33
33
 
34
- = require 'omniture'
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**
@@ -0,0 +1,3 @@
1
+ //= require omniture
2
+ //= require s_code
3
+
@@ -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
@@ -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 's_code'
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Asyncomni
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -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
- <%= tag(:iframe, id: 'omnitureFrame', name: 'omnitureFrame', width: '0', height: '0', style: 'visibility:hidden', data: {'page-name' => page_name, 'omniture-url' => omniture_url }) %>
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
@@ -49,3 +49,53 @@ Completed 200 OK in 31ms (Views: 30.5ms | ActiveRecord: 0.0ms)
49
49
   (0.0ms) rollback transaction
50
50
   (0.0ms) begin transaction
51
51
   (0.0ms) rollback transaction
52
+  (0.4ms) begin transaction
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
+  (0.1ms) rollback transaction
57
+  (0.1ms) begin transaction
58
+  (0.1ms) rollback transaction
59
+  (0.1ms) begin transaction
60
+  (0.1ms) rollback transaction
61
+  (0.1ms) begin transaction
62
+  (0.1ms) rollback transaction
63
+  (0.1ms) begin transaction
64
+  (0.1ms) rollback transaction
65
+  (0.0ms) begin transaction
66
+  (0.1ms) rollback transaction
67
+  (0.1ms) begin transaction
68
+  (0.1ms) rollback transaction
69
+  (0.0ms) begin transaction
70
+  (0.1ms) rollback transaction
71
+  (0.1ms) begin transaction
72
+  (0.1ms) rollback transaction
73
+  (0.1ms) begin transaction
74
+  (0.1ms) rollback transaction
75
+  (0.1ms) begin transaction
76
+  (0.1ms) rollback transaction
77
+  (0.2ms) begin transaction
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
+  (0.1ms) rollback transaction
82
+  (0.1ms) begin transaction
83
+  (0.0ms) rollback transaction
84
+  (0.0ms) begin transaction
85
+  (0.0ms) rollback transaction
86
+  (0.0ms) begin transaction
87
+  (0.0ms) rollback transaction
88
+  (0.0ms) begin transaction
89
+  (0.0ms) rollback transaction
90
+  (0.0ms) begin transaction
91
+  (0.0ms) rollback transaction
92
+  (0.0ms) begin transaction
93
+  (0.0ms) rollback transaction
94
+  (0.0ms) begin transaction
95
+  (0.0ms) rollback transaction
96
+  (0.0ms) begin transaction
97
+  (0.0ms) rollback transaction
98
+  (0.0ms) begin transaction
99
+  (0.0ms) rollback transaction
100
+  (0.0ms) begin transaction
101
+  (0.0ms) 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&amp;user_id=unknown&amp;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.3
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-26 00:00:00.000000000 Z
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