middleman-google-analytics 2.0.1 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/CHANGELOG.md +8 -0
- data/LICENSE +1 -1
- data/README.md +6 -5
- data/features/google_analytics.feature +19 -1
- data/features/google_analytics_universal.feature +17 -1
- data/fixtures/enhanced-link-attribution-app/config.rb +4 -0
- data/fixtures/enhanced-link-attribution-app/source/google-analytics-universal.html.erb +1 -0
- data/fixtures/enhanced-link-attribution-app/source/google-analytics.html.erb +1 -0
- data/fixtures/full-app/config.rb +1 -0
- data/lib/middleman-google-analytics/analytics.js.erb +2 -0
- data/lib/middleman-google-analytics/analytics_universal.js.erb +1 -0
- data/lib/middleman-google-analytics/extension.rb +1 -0
- data/lib/middleman-google-analytics/version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8df82e8c98ac618f06e7549481055ed8875b932
|
4
|
+
data.tar.gz: bd957e790ddc53b8c246efc98c51e2067d22db50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6f1eaeb419ea28835f1c3539328954c2e2075edeb1f21f0b1094a06f27cdab022caad8e7577ee2f6edfd218ed471e80833ed36107d7c18aa7efafce00ed8802
|
7
|
+
data.tar.gz: 17ff573c4a48a5842035c28f730c262afbbe2f941e85c4dbf2a14405e261a9f57efdca655bc54620b42607c238016059266291d839f6e747d6dd16eb4b6623ca
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/LICENSE
CHANGED
data/README.md
CHANGED
@@ -14,7 +14,7 @@ keeps your config in `config.rb`, where it belongs.
|
|
14
14
|
1. Specify the dependency in your project's `Gemfile`:
|
15
15
|
|
16
16
|
```ruby
|
17
|
-
gem 'middleman-google-analytics', '~> 2.
|
17
|
+
gem 'middleman-google-analytics', '~> 2.1'
|
18
18
|
```
|
19
19
|
|
20
20
|
2. Activate the Google Analytics extension in your project's `config.rb`:
|
@@ -65,9 +65,7 @@ keeps your config in `config.rb`, where it belongs.
|
|
65
65
|
<%= google_analytics_universal_tag %>
|
66
66
|
```
|
67
67
|
|
68
|
-
:bulb: Note: [The Universal Analytics tag is the new operating standard for the Google Analytics tracking tag.]
|
69
|
-
|
70
|
-
[1]: https://support.google.com/tagmanager/answer/6107124?hl=en
|
68
|
+
:bulb: Note: [The Universal Analytics tag is the new operating standard for the Google Analytics tracking tag.](https://support.google.com/analytics/answer/2790010)
|
71
69
|
|
72
70
|
## Configuration
|
73
71
|
|
@@ -85,6 +83,9 @@ activate :google_analytics do |ga|
|
|
85
83
|
# Tracking across multiple domains and subdomains (default = false)
|
86
84
|
ga.allow_linker = false
|
87
85
|
|
86
|
+
# Enhanced Link Attribution (default = false)
|
87
|
+
ga.enhanced_link_attribution = false
|
88
|
+
|
88
89
|
# Tracking Code Debugger (default = false)
|
89
90
|
ga.debug = false
|
90
91
|
|
@@ -124,6 +125,6 @@ display the GA tracking code.
|
|
124
125
|
|
125
126
|
## License
|
126
127
|
|
127
|
-
Copyright (c) 2014-
|
128
|
+
Copyright (c) 2014-2016 Daniel Bayerlein. See [LICENSE](./LICENSE) for details.
|
128
129
|
|
129
130
|
Copyright (c) 2013 Jon Frisby.
|
@@ -102,12 +102,30 @@ Feature: Google Analytics tag helper
|
|
102
102
|
<script type="text/javascript">var _gaq=_gaq||[];_gaq.push(["_setAccount","UA-123456-78"]),_gaq.push(["_trackPageview"]),function(){var t=document.createElement("script");t.type="text/javascript",t.async=!0,t.src=("https:"==document.location.protocol?"//ssl":"//www")+".google-analytics.com/ga.js";var e=document.getElementsByTagName("script")[0];e.parentNode.insertBefore(t,e)}();</script>
|
103
103
|
"""
|
104
104
|
|
105
|
+
Scenario: Enhanced Link Attribution
|
106
|
+
Given the Server is running at "enhanced-link-attribution-app"
|
107
|
+
When I go to "/google-analytics.html"
|
108
|
+
Then I should see:
|
109
|
+
"""
|
110
|
+
<script type="text/javascript">
|
111
|
+
var _gaq = _gaq || [];
|
112
|
+
_gaq.push(["_setAccount", "UA-123456-78"]);
|
113
|
+
_gaq.push(["_require", "inpage_linkid", "//www.google-analytics.com/plugins/ga/inpage_linkid.js"]);
|
114
|
+
_gaq.push(["_trackPageview"]);
|
115
|
+
(function() {
|
116
|
+
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
|
117
|
+
ga.src = ('https:' == document.location.protocol ? '//ssl' : '//www') + '.google-analytics.com/ga.js';
|
118
|
+
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
119
|
+
})();
|
120
|
+
</script>
|
121
|
+
"""
|
122
|
+
|
105
123
|
Scenario: Full options
|
106
124
|
Given the Server is running at "full-app"
|
107
125
|
When I go to "/google-analytics.html"
|
108
126
|
Then I should see:
|
109
127
|
"""
|
110
|
-
<script type="text/javascript">var _gaq=_gaq||[];_gaq.push(["_setAccount","UA-123456-78"]),_gaq.push(["_setDomainName","example.com"]),_gaq.push(["_setAllowLinker",!0]),_gaq.push(["_gat._anonymizeIp"]),_gaq.push(["_trackPageview"]),function(){var e=document.createElement("script");e.type="text/javascript",e.async=!0,e.src=("https:"==document.location.protocol?"//ssl":"//www")+".google-analytics.com/u/ga_debug.js";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(e,a)}();</script>
|
128
|
+
<script type="text/javascript">var _gaq=_gaq||[];_gaq.push(["_setAccount","UA-123456-78"]),_gaq.push(["_setDomainName","example.com"]),_gaq.push(["_setAllowLinker",!0]),_gaq.push(["_gat._anonymizeIp"]),_gaq.push(["_require","inpage_linkid","//www.google-analytics.com/plugins/ga/inpage_linkid.js"]),_gaq.push(["_trackPageview"]),function(){var e=document.createElement("script");e.type="text/javascript",e.async=!0,e.src=("https:"==document.location.protocol?"//ssl":"//www")+".google-analytics.com/u/ga_debug.js";var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(e,a)}();</script>
|
111
129
|
"""
|
112
130
|
|
113
131
|
Scenario: JavaScript output style
|
@@ -74,12 +74,28 @@ Feature: Google Analytics Universal tag helper
|
|
74
74
|
<script type="text/javascript">!function(e,a,t,n,c,o,s){e.GoogleAnalyticsObject=c,e[c]=e[c]||function(){(e[c].q=e[c].q||[]).push(arguments)},e[c].l=1*new Date,o=a.createElement(t),s=a.getElementsByTagName(t)[0],o.async=1,o.src=n,s.parentNode.insertBefore(o,s)}(window,document,"script","//www.google-analytics.com/analytics.js","ga"),ga("create","UA-123456-78","auto"),ga("send","pageview");</script>
|
75
75
|
"""
|
76
76
|
|
77
|
+
Scenario: Enhanced Link Attribution
|
78
|
+
Given the Server is running at "enhanced-link-attribution-app"
|
79
|
+
When I go to "/google-analytics-universal.html"
|
80
|
+
Then I should see:
|
81
|
+
"""
|
82
|
+
<script type="text/javascript">
|
83
|
+
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
84
|
+
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
|
85
|
+
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
|
86
|
+
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
|
87
|
+
ga('create', 'UA-123456-78', 'auto');
|
88
|
+
ga('require', 'linkid');
|
89
|
+
ga('send', 'pageview');
|
90
|
+
</script>
|
91
|
+
"""
|
92
|
+
|
77
93
|
Scenario: Full options
|
78
94
|
Given the Server is running at "full-app"
|
79
95
|
When I go to "/google-analytics-universal.html"
|
80
96
|
Then I should see:
|
81
97
|
"""
|
82
|
-
<script type="text/javascript">!function(e,a,n,t,c,o
|
98
|
+
<script type="text/javascript">!function(e,a,n,t,c,i,o){e.GoogleAnalyticsObject=c,e[c]=e[c]||function(){(e[c].q=e[c].q||[]).push(arguments)},e[c].l=1*new Date,i=a.createElement(n),o=a.getElementsByTagName(n)[0],i.async=1,i.src=t,o.parentNode.insertBefore(i,o)}(window,document,"script","//www.google-analytics.com/analytics.js","ga"),ga("create","UA-123456-78","example.com",{allowLinker:!0}),ga("set","anonymizeIp",!0),ga("require","linkid"),ga("send","pageview");</script>
|
83
99
|
"""
|
84
100
|
|
85
101
|
Scenario: JavaScript output style
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= google_analytics_universal_tag %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= google_analytics_tag %>
|
data/fixtures/full-app/config.rb
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
<%
|
2
2
|
file = @options.debug ? 'u/ga_debug' : 'ga'
|
3
|
+
pluginUrl = '//www.google-analytics.com/plugins/ga/inpage_linkid.js'
|
3
4
|
|
4
5
|
gaq = []
|
5
6
|
gaq << ['_setAccount', "#{@options.tracking_id}"]
|
6
7
|
gaq << ['_setDomainName', "#{@options.domain_name}"] if @options.domain_name
|
7
8
|
gaq << ['_setAllowLinker', true] if @options.allow_linker
|
8
9
|
gaq << ['_gat._anonymizeIp'] if @options.anonymize_ip
|
10
|
+
gaq << ['_require', 'inpage_linkid', pluginUrl] if @options.enhanced_link_attribution
|
9
11
|
gaq << ['_trackPageview']
|
10
12
|
%>
|
11
13
|
var _gaq = _gaq || [];
|
@@ -7,6 +7,7 @@
|
|
7
7
|
ga = []
|
8
8
|
ga << "ga('create', #{create_options.join(', ')});"
|
9
9
|
ga << "ga('set', 'anonymizeIp', true);" if @options.anonymize_ip
|
10
|
+
ga << "ga('require', 'linkid');" if @options.enhanced_link_attribution
|
10
11
|
ga << "ga('send', 'pageview');"
|
11
12
|
%>
|
12
13
|
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
|
@@ -8,6 +8,7 @@ module Middleman
|
|
8
8
|
option :domain_name, nil, 'Tracking across a domain and its subdomains'
|
9
9
|
option :allow_linker, false, 'Tracking across multiple domains and ' \
|
10
10
|
'subdomains'
|
11
|
+
option :enhanced_link_attribution, false, 'Enhanced Link Attribution'
|
11
12
|
option :debug, false, 'Tracking Code Debugger'
|
12
13
|
option :development, true, 'Tracking in development environment'
|
13
14
|
option :minify, false, 'Compress the JavaScript code'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: middleman-google-analytics
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Daniel Bayerlein
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2016-02-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: middleman-core
|
@@ -107,6 +107,9 @@ files:
|
|
107
107
|
- fixtures/disable-app/config.rb
|
108
108
|
- fixtures/disable-app/source/google-analytics-universal.html.erb
|
109
109
|
- fixtures/disable-app/source/google-analytics.html.erb
|
110
|
+
- fixtures/enhanced-link-attribution-app/config.rb
|
111
|
+
- fixtures/enhanced-link-attribution-app/source/google-analytics-universal.html.erb
|
112
|
+
- fixtures/enhanced-link-attribution-app/source/google-analytics.html.erb
|
110
113
|
- fixtures/full-app/config.rb
|
111
114
|
- fixtures/full-app/source/google-analytics-universal.html.erb
|
112
115
|
- fixtures/full-app/source/google-analytics.html.erb
|
@@ -140,7 +143,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
143
|
version: '0'
|
141
144
|
requirements: []
|
142
145
|
rubyforge_project:
|
143
|
-
rubygems_version: 2.
|
146
|
+
rubygems_version: 2.5.1
|
144
147
|
signing_key:
|
145
148
|
specification_version: 4
|
146
149
|
summary: A Middleman plugin for handling Google Analytics tracking code.
|