utopia-tags-google-analytics 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/README.md +59 -0
- data/Rakefile +1 -0
- data/lib/utopia/tags/google-analytics.rb +44 -0
- data/lib/utopia/tags/google-analytics/version.rb +7 -0
- data/utopia-tags-google-analytics.gemspec +31 -0
- metadata +83 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
YmZkNmYxZjhkOTI5ZDhlYWFhOTk4Y2NiNWMwYTBhMDI4OTY5ZGQ2Yw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NWI5OGE3NTgxOTg2YTljYmRlZWQ1OGFhNjkzZjhlMTM4MDEyY2VhMg==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NGYzZDE2NjYzMDM3ZjIzODgyMDVkMmVhYWRmYTdkNWM4YWIxZmFlYjU3ZWQ4
|
10
|
+
NWM3NWFiY2RhNzAzYWM0MWI5MzY4ZGI2OGE1N2NkZGI3MjNkODU2NDA0YjVi
|
11
|
+
Y2M3M2Y1ZTI0MmJjMDQ4MTZlZWNkNGNjZGRhMWFjMjVhNmY5ZGY=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ODBkZTMxYzQwNDczNWJmNmRlMGIyOTcwNmE3MzkxNTdmZDc0OGY0MWI3OTJk
|
14
|
+
OWJkZjZiNmZiMTk2YTRkNjlmZmJmNmNlN2M0NzAxZGM2YTYxYzgxZjg2MDE5
|
15
|
+
MWFiNDc3N2ZhMmQyNjMzOTYyYzljMjkyZDU3ZWM2ZDdlOTdkYzk=
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,59 @@
|
|
1
|
+
# Utopia::Tags::GoogleAnalytics
|
2
|
+
|
3
|
+
[Utopia](http://www.codeotaku.com/projects/utopia) is a website generation framework which provides a robust set of tools to build highly complex dynamic websites. It uses the filesystem heavily for content and provides frameworks for interacting with files and directories as structure representing the website.
|
4
|
+
|
5
|
+
This package includes a useful `<google-analytics>` tag for easily integrating with Google Analytics.
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
gem 'utopia-tags-google-analytics'
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install utopia-tags-google-analytics
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
You might want to combine this tag with the `<env>` tag to ensure that Google Analytics is only tracked in production. Simply set the `id` attribute to whatever you have been provided by Google Analytics:
|
24
|
+
|
25
|
+
<env only="production">
|
26
|
+
<google-analytics id="UA-XXXXXXX-XX" />
|
27
|
+
</env>
|
28
|
+
|
29
|
+
## Contributing
|
30
|
+
|
31
|
+
1. Fork it
|
32
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
33
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
34
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
35
|
+
5. Create new Pull Request
|
36
|
+
|
37
|
+
## License
|
38
|
+
|
39
|
+
Released under the MIT license.
|
40
|
+
|
41
|
+
Copyright, 2012, by [Samuel G. D. Williams](http://www.codeotaku.com/samuel-williams).
|
42
|
+
|
43
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
44
|
+
of this software and associated documentation files (the "Software"), to deal
|
45
|
+
in the Software without restriction, including without limitation the rights
|
46
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
47
|
+
copies of the Software, and to permit persons to whom the Software is
|
48
|
+
furnished to do so, subject to the following conditions:
|
49
|
+
|
50
|
+
The above copyright notice and this permission notice shall be included in
|
51
|
+
all copies or substantial portions of the Software.
|
52
|
+
|
53
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
54
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
55
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
56
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
57
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
58
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
59
|
+
THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# Copyright, 2012, by Samuel G. D. Williams. <http://www.codeotaku.com>
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
8
|
+
# furnished to do so, subject to the following conditions:
|
9
|
+
#
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
11
|
+
# all copies or substantial portions of the Software.
|
12
|
+
#
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
19
|
+
# THE SOFTWARE.
|
20
|
+
|
21
|
+
require 'utopia/tags'
|
22
|
+
|
23
|
+
module Utopia
|
24
|
+
module Tags
|
25
|
+
module GoogleAnalytics
|
26
|
+
def self.call(transaction, state)
|
27
|
+
html = <<-EOF
|
28
|
+
<script type="text/javascript">
|
29
|
+
var _gaq = _gaq || []; _gaq.push(['_setAccount', #{state[:id].to_quoted_string}]); _gaq.push(['_trackPageview']);
|
30
|
+
(function() {
|
31
|
+
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
32
|
+
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
|
33
|
+
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
34
|
+
})();
|
35
|
+
</script>
|
36
|
+
EOF
|
37
|
+
|
38
|
+
transaction.cdata(html)
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
Utopia::Tags.register("google-analytics", Utopia::Tags::GoogleAnalytics)
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'utopia/tags/google-analytics/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "utopia-tags-google-analytics"
|
8
|
+
spec.version = Utopia::Tags::GoogleAnalytics::VERSION
|
9
|
+
spec.authors = ["Samuel Williams"]
|
10
|
+
spec.email = ["samuel.williams@oriontransfer.co.nz"]
|
11
|
+
spec.description = <<-EOF
|
12
|
+
Utopia is a website generation framework which provides a robust set of tools
|
13
|
+
to build highly complex dynamic websites. It uses the filesystem heavily for
|
14
|
+
content and provides frameworks for interacting with files and directories as
|
15
|
+
structure representing the website.
|
16
|
+
|
17
|
+
This package includes a useful <google-analytics> tag for easily integrating
|
18
|
+
with Google Analytics.
|
19
|
+
EOF
|
20
|
+
spec.summary = %q{A Google Analytics tag for use with the Utopia web framework.}
|
21
|
+
spec.homepage = ""
|
22
|
+
spec.license = "MIT"
|
23
|
+
|
24
|
+
spec.files = `git ls-files`.split($/)
|
25
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
26
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
27
|
+
spec.require_paths = ["lib"]
|
28
|
+
|
29
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
30
|
+
spec.add_development_dependency "rake"
|
31
|
+
end
|
metadata
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: utopia-tags-google-analytics
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.12.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Samuel Williams
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-04-09 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ! '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: ! "\t\tUtopia is a website generation framework which provides a robust
|
42
|
+
set of tools\n\t\tto build highly complex dynamic websites. It uses the filesystem
|
43
|
+
heavily for\n\t\tcontent and provides frameworks for interacting with files and
|
44
|
+
directories as\n\t\tstructure representing the website.\n\n\t\tThis package includes
|
45
|
+
a useful <google-analytics> tag for easily integrating\n\t\twith Google Analytics.\n"
|
46
|
+
email:
|
47
|
+
- samuel.williams@oriontransfer.co.nz
|
48
|
+
executables: []
|
49
|
+
extensions: []
|
50
|
+
extra_rdoc_files: []
|
51
|
+
files:
|
52
|
+
- .gitignore
|
53
|
+
- Gemfile
|
54
|
+
- README.md
|
55
|
+
- Rakefile
|
56
|
+
- lib/utopia/tags/google-analytics.rb
|
57
|
+
- lib/utopia/tags/google-analytics/version.rb
|
58
|
+
- utopia-tags-google-analytics.gemspec
|
59
|
+
homepage: ''
|
60
|
+
licenses:
|
61
|
+
- MIT
|
62
|
+
metadata: {}
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - ! '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
requirements: []
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 2.0.2
|
80
|
+
signing_key:
|
81
|
+
specification_version: 4
|
82
|
+
summary: A Google Analytics tag for use with the Utopia web framework.
|
83
|
+
test_files: []
|