liquid-google-analytics 1.0.2 → 1.1.0
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/LICENSE.md +21 -21
- data/README.md +60 -46
- data/lib/liquid-google-analytics.rb +6 -5
- data/lib/liquid/google_analytics.rb +49 -29
- data/lib/liquid/plugin_version.rb +5 -5
- metadata +19 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 64ca365e7fd75238fbf47bed6e2ea4433497a3bc
|
4
|
+
data.tar.gz: ddce2d7e49b77b1acb6197de0f1f33d805e93b70
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5e498809aaa1955e730316fef4b695e91797cb0a78bee7a61c5c23738b48ab71d890c3cb6ceabcd102f953e2230e6eccb1f122cf4f66496e617e2ff38eb579d
|
7
|
+
data.tar.gz: 55ac4295ca2790824d3b9b18ada967274202c7ac589936b65642077d94a4ba7165567f6138d1854534934afcdfd33423858dcce23234280ab02c921984ec3be0
|
data/LICENSE.md
CHANGED
@@ -1,21 +1,21 @@
|
|
1
|
-
The MIT License (MIT)
|
2
|
-
|
3
|
-
Copyright (c) 2016 Rohan Sakhale
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
7
|
-
in the Software without restriction, including without limitation the rights
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
10
|
-
furnished to do so, subject to the following conditions:
|
11
|
-
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
13
|
-
all copies or substantial portions of the Software.
|
14
|
-
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
-
THE SOFTWARE.
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Rohan Sakhale
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
CHANGED
@@ -1,46 +1,60 @@
|
|
1
|
-
# Liquid Google Analytics Tag
|
2
|
-
|
3
|
-
This plugin helps generate Google Analytics code snippet easily
|
4
|
-
|
5
|
-
### Installation
|
6
|
-
|
7
|
-
This plugin is available as a [RubyGem](https://rubygems.org/gems/liquid-google-analytics/)
|
8
|
-
|
9
|
-
Add this line to your application's Gemfile:
|
10
|
-
|
11
|
-
```
|
12
|
-
gem 'liquid-google-analytics'
|
13
|
-
```
|
14
|
-
|
15
|
-
And then execute the `bundle install` command to install the gem.
|
16
|
-
|
17
|
-
Alternatively, you can also manually install the gem using the following command:
|
18
|
-
|
19
|
-
```
|
20
|
-
$ gem install liquid-google-analytics
|
21
|
-
```
|
22
|
-
|
23
|
-
For Jekyll Users, after the plugin has been installed successfully, add the following lines to your _config.yml in order to tell Jekyll to use the plugin:
|
24
|
-
|
25
|
-
```yaml
|
26
|
-
gems:
|
27
|
-
- liquid-google-analytics
|
28
|
-
```
|
29
|
-
|
30
|
-
### Usage
|
31
|
-
|
32
|
-
You need to use `google_analytics` as liquid tag and pass the Tracking Code as parameter shown below
|
33
|
-
|
34
|
-
```
|
35
|
-
{
|
36
|
-
```
|
37
|
-
|
38
|
-
###
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
1
|
+
# Liquid Google Analytics Tag [](https://gitlab.com/SaiAshirwadInformatia/LiquidGoogleAnalytics/commits/master) [](https://badge.fury.io/rb/liquid-google-analytics) [](https://gitlab.com/SaiAshirwadInformatia/LiquidGoogleAnalytics/commits/master)
|
2
|
+
|
3
|
+
This plugin helps generate Google Analytics code snippet easily with the help of Liquid Tag or Liquid Variable Filter
|
4
|
+
|
5
|
+
### Installation
|
6
|
+
|
7
|
+
This plugin is available as a [RubyGem](https://rubygems.org/gems/liquid-google-analytics/)
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```
|
12
|
+
gem 'liquid-google-analytics'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute the `bundle install` command to install the gem.
|
16
|
+
|
17
|
+
Alternatively, you can also manually install the gem using the following command:
|
18
|
+
|
19
|
+
```
|
20
|
+
$ gem install liquid-google-analytics
|
21
|
+
```
|
22
|
+
|
23
|
+
For Jekyll Users, after the plugin has been installed successfully, add the following lines to your _config.yml in order to tell Jekyll to use the plugin:
|
24
|
+
|
25
|
+
```yaml
|
26
|
+
gems:
|
27
|
+
- liquid-google-analytics
|
28
|
+
```
|
29
|
+
|
30
|
+
### Usage
|
31
|
+
|
32
|
+
You need to use `google_analytics` as liquid tag and pass the Tracking Code as parameter shown below
|
33
|
+
|
34
|
+
```
|
35
|
+
{% google_analytics UA-12345 %}
|
36
|
+
```
|
37
|
+
|
38
|
+
### Alternate
|
39
|
+
|
40
|
+
Optionally now you can also maintain Google Analytics code in config and use filter for variable as below
|
41
|
+
|
42
|
+
```yaml
|
43
|
+
ga_code: UA-12345
|
44
|
+
```
|
45
|
+
|
46
|
+
```
|
47
|
+
{{ site.ga_code | google_analytics }}
|
48
|
+
```
|
49
|
+
|
50
|
+
### Contribute
|
51
|
+
|
52
|
+
Fork this repository, create your branch, make changes and then issue a pull request.
|
53
|
+
|
54
|
+
If you find bugs or have new ideas that you do not want to implement yourself, file a bug report.
|
55
|
+
|
56
|
+
### Copyright
|
57
|
+
|
58
|
+
Copyright (c) 2016 Rohan Sakhale
|
59
|
+
|
60
|
+
License: [MIT](LICENSE.md)
|
@@ -1,5 +1,6 @@
|
|
1
|
-
# Generate script code for Google Analytics with Liquid Tag
|
2
|
-
require 'liquid'
|
3
|
-
require 'liquid/google_analytics'
|
4
|
-
|
5
|
-
Liquid::Template.register_tag 'google_analytics', Liquid::
|
1
|
+
# Generate script code for Google Analytics with Liquid Tag
|
2
|
+
require 'liquid'
|
3
|
+
require 'liquid/google_analytics'
|
4
|
+
|
5
|
+
Liquid::Template.register_tag 'google_analytics', Liquid::GoogleAnalyticsTag
|
6
|
+
Liquid::Template.register_filter(GoogleAnalyticsFilterModule)
|
@@ -1,30 +1,50 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
(
|
7
|
-
(
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
1
|
+
module LiquidGoogleAnalytics
|
2
|
+
TEMPLATE = <<-EOF
|
3
|
+
<script>
|
4
|
+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
5
|
+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
6
|
+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
7
|
+
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
|
8
|
+
|
9
|
+
ga('create', '%s', 'auto');
|
10
|
+
ga('send', 'pageview');
|
11
|
+
|
12
|
+
</script>
|
13
|
+
EOF
|
14
|
+
end
|
15
|
+
module GoogleAnalyticsFilterModule
|
16
|
+
|
17
|
+
def google_analytics(input)
|
18
|
+
code = ""
|
19
|
+
code = format(LiquidGoogleAnalytics::TEMPLATE, input)
|
20
|
+
code
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
module Liquid
|
25
|
+
|
26
|
+
class GoogleAnalyticsTag < Liquid::Tag
|
27
|
+
|
28
|
+
def initialize(tag_name, markup, options)
|
29
|
+
super
|
30
|
+
tracking_parsed_code = Liquid::Template.parse(markup.to_s.strip).render
|
31
|
+
unless tracking_parsed_code
|
32
|
+
tracking_parsed_code = markup.to_s.strip
|
33
|
+
end
|
34
|
+
@tracking_code = tracking_parsed_code
|
35
|
+
end
|
36
|
+
|
37
|
+
def render(context)
|
38
|
+
code = ""
|
39
|
+
if context['code']
|
40
|
+
@tracking_code = context['code']
|
41
|
+
elsif context['tracking_code']
|
42
|
+
@tracking_code = context['tracking_code']
|
43
|
+
end
|
44
|
+
if @tracking_code
|
45
|
+
code = format(LiquidGoogleAnalytics::TEMPLATE, @tracking_code)
|
46
|
+
end
|
47
|
+
code
|
48
|
+
end
|
49
|
+
end
|
30
50
|
end
|
@@ -1,6 +1,6 @@
|
|
1
|
-
|
2
|
-
module Liquid
|
3
|
-
class GoogleAnalytics
|
4
|
-
VERSION = "1.0
|
5
|
-
end
|
1
|
+
|
2
|
+
module Liquid
|
3
|
+
class GoogleAnalytics
|
4
|
+
VERSION = "1.1.0".freeze
|
5
|
+
end
|
6
6
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: liquid-google-analytics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Rohan Sakhale
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-11-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 3.3.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 3.3.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 5.9.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: simplecov
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: 0.12.0
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: 0.12.0
|
69
83
|
description: Generate Google Analytics Script code with simple Liquid Tag
|
70
84
|
email: rohansakhale@gmail.com
|
71
85
|
executables: []
|
@@ -98,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
98
112
|
version: '0'
|
99
113
|
requirements: []
|
100
114
|
rubyforge_project:
|
101
|
-
rubygems_version: 2.
|
115
|
+
rubygems_version: 2.5.1
|
102
116
|
signing_key:
|
103
117
|
specification_version: 4
|
104
118
|
summary: Generate Google Analytics Script code with simple Liquid Tag
|