wheelhouse-google-analytics 1.0 → 1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: a54cd70064201375d584eda8fc37a49ca4d144d7
4
+ data.tar.gz: 051ca45702b58ade6006ccf24b021125b2286cb1
5
+ SHA512:
6
+ metadata.gz: f3b39b27fe48bb9dcc750f78224b8415a563faa6e23fbe1dfaa44252a338d7554039f001ef00da7b3b76e26431c7be7b9ad9b806ca668154664bed4306e8b9ce
7
+ data.tar.gz: 916929f6fb21f6f8e00bc301e5c2b7dc6123575782a352be80bba88b8808ecca438dd0592635f97a24aefd2e9a26c240212522c7c7e77659dcd926cb14df601b
data/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2012-14 Sam Pohlenz
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -1,3 +1,4 @@
1
1
  Wheelhouse::Site.class_eval do
2
2
  property :google_analytics_code, String
3
+ validates_format_of :google_analytics_code, :with => /\AUA-\d{4,9}-\d{1,4}\Z/i, :allow_blank => true
3
4
  end
@@ -1,19 +1,9 @@
1
1
  module GoogleAnalytics::AnalyticsHelper
2
- TRACKING_CODE = <<-EOJS
3
- var _gaq = _gaq || [];
4
- _gaq.push(['_setAccount', '{{CODE}}']);
5
- _gaq.push(['_trackPageview']);
6
-
7
- (function() {
8
- var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
9
- ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
10
- var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
11
- })();
12
- EOJS
13
-
14
2
  def google_analytics
15
- if Rails.env.production? && site.google_analytics_code? && !controller.env['wheelhouse.preview']
16
- javascript_tag(TRACKING_CODE.sub("{{CODE}}", site.google_analytics_code))
17
- end
3
+ render "google_analytics/tracking_code" if render_google_analytics?
4
+ end
5
+
6
+ def render_google_analytics?
7
+ Rails.env.production? && site.google_analytics_code? && !controller.env['wheelhouse.preview']
18
8
  end
19
9
  end
@@ -0,0 +1,10 @@
1
+ <script>
2
+ (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
3
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
4
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
5
+ })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
6
+
7
+ ga('create', '<%= site.google_analytics_code %>', '<%= site.domain %>');
8
+ ga('send', 'pageview');
9
+
10
+ </script>
@@ -3,3 +3,11 @@ en:
3
3
  attributes:
4
4
  wheelhouse/site:
5
5
  google_analytics_code: Google Analytics Tracking Code
6
+
7
+ errors:
8
+ models:
9
+ wheelhouse/site:
10
+ attributes:
11
+ google_analytics_code:
12
+ invalid: A valid tracking code is required (e.g. UA-12345678-1)
13
+
metadata CHANGED
@@ -1,30 +1,27 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wheelhouse-google-analytics
3
3
  version: !ruby/object:Gem::Version
4
- version: '1.0'
5
- prerelease:
4
+ version: '1.1'
6
5
  platform: ruby
7
6
  authors:
8
7
  - Sam Pohlenz
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-08-02 00:00:00.000000000 Z
11
+ date: 2014-06-13 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: wheelhouse
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
19
  version: '1.0'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
26
  version: '1.0'
30
27
  description: Integrates Google Analytics into your Wheelhouse CMS site.
@@ -33,35 +30,36 @@ executables: []
33
30
  extensions: []
34
31
  extra_rdoc_files: []
35
32
  files:
33
+ - LICENSE
34
+ - README.md
36
35
  - app/extensions/wheelhouse/site.rb
37
36
  - app/helpers/google_analytics/analytics_helper.rb
37
+ - app/templates/google_analytics/_tracking_code.html.erb
38
38
  - app/views/google_analytics/_site_options.html.haml
39
39
  - config/locales/en.yml
40
40
  - lib/wheelhouse-google-analytics.rb
41
- - README.md
42
41
  homepage: https://www.wheelhousecms.com/
43
- licenses: []
42
+ licenses:
43
+ - MIT
44
+ metadata: {}
44
45
  post_install_message:
45
46
  rdoc_options: []
46
47
  require_paths:
47
48
  - lib
48
49
  required_ruby_version: !ruby/object:Gem::Requirement
49
- none: false
50
50
  requirements:
51
- - - ! '>='
51
+ - - ">="
52
52
  - !ruby/object:Gem::Version
53
53
  version: 1.8.7
54
54
  required_rubygems_version: !ruby/object:Gem::Requirement
55
- none: false
56
55
  requirements:
57
- - - ! '>='
56
+ - - ">="
58
57
  - !ruby/object:Gem::Version
59
58
  version: 1.3.6
60
59
  requirements: []
61
60
  rubyforge_project:
62
- rubygems_version: 1.8.24
61
+ rubygems_version: 2.2.2
63
62
  signing_key:
64
- specification_version: 3
63
+ specification_version: 4
65
64
  summary: Wheelhouse CMS Google Analytics plugin
66
65
  test_files: []
67
- has_rdoc: