govuk_admin_template 6.1.0 → 6.2.0

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: c0713235ca6656651999c843e4663637e79a2a3d
4
- data.tar.gz: 72c183af9cebe83431eec860bb63048cddb7de80
3
+ metadata.gz: f135f7b81ee77616dbe1e2f14ffb0be2c3b9153c
4
+ data.tar.gz: 7bc98f7100e49d1d0f01253b2c4d7b6e177ef2e5
5
5
  SHA512:
6
- metadata.gz: 0338560575f358953c640e2dd37eb80e1a5384da2fedcd536bc0a5d029e2203838a2c6a6ebf8c6f0adb3e6d845c9a569d1a3c7470c910aede8f975e996be8e01
7
- data.tar.gz: 296bce22aef9b253b7fcbf4ba1e98b1a9eae541260654a499d1b5b5a9d42880d7c1b51108a11766544f0fd8e9730845ae5255743d2c8c3b180de0cac17e73d8f
6
+ metadata.gz: 4c8563155c86a59a4fa1faa0b71c01de63b69975e1e8b15902eef8034702b45fdaeaa248cdf3373b94b9de8f5650e8d568835149d0295b5c0c69d037a4352c4b
7
+ data.tar.gz: 38c22cea1a864e453a5753f4d3a067153f18e1cabe94c93867081e33a539bdd4735a7399dc2f256e970673b4a6234f4c0f6c4caf52fe7f8965c4f866768e7b91
data/CHANGELOG.md CHANGED
@@ -1,11 +1,19 @@
1
+ # 6.2.0
2
+
3
+ * Add `GOVUKAdmin.setDimension` to allow setting custom dimensions for GA
4
+ * Add `before_pageview_js` content block that is injected into the layout template GA code before we track the page view. This allows for running more GA code (like setting custom dimensions) before the page view is tracked.
5
+ * Add `enable_google_analytics_in_tests` config setting to allow including the GA code block in the layout in Rails test environments. This allows upstream apps to test any GA code they might include.
6
+
1
7
  # 6.1.0
2
8
 
3
9
  * Update the jquery-rails dependency to 4.3.1 for compatibility with the latest
4
10
  version of nokogiri
11
+ * Compile test favicon to remove Rails 5.1 asset pipeline fallback deprecation
12
+ message
5
13
 
6
14
  # 6.0.0
7
15
 
8
- * Changes method call from `GOVUKAdmin.trackEvent(action, label, value)` to `GOVUKAdmin.trackEvent(category, action, options)`. Categories are now mandatory. Calls to `GOVUKAdmin.trackEvent` should be changed to use the latest method signature.
16
+ * Changes method call from `GOVUKAdmin.trackEvent(action, label, value)` to `GOVUKAdmin.trackEvent(category, action, options)`. Categories are now mandatory. Calls to `GOVUKAdmin.trackEvent` should be changed to use the latest method signature.
9
17
 
10
18
  # 5.0.1
11
19
 
@@ -127,6 +127,17 @@
127
127
  }
128
128
  }
129
129
 
130
+ // Google Analytics custom dimensions
131
+ GOVUKAdmin.setDimension = function(index, value) {
132
+ // https://developers.google.com/analytics/devguides/collection/analyticsjs/custom-dims-mets
133
+ // The custom dimension index must be configured within the
134
+ // Universal Analytics profile
135
+
136
+ if (typeof root.ga === "function") {
137
+ root.ga('set', 'dimension' + index, String(value));
138
+ }
139
+ }
140
+
130
141
  /*
131
142
  Cookie methods
132
143
  ==============
@@ -5,6 +5,7 @@
5
5
  app_title = content_for?(:app_title) ? yield(:app_title) : GovukAdminTemplate::Config.app_title
6
6
  has_navbar_content = GovukAdminTemplate::Config.show_signout || content_for?(:navbar_right) || content_for?(:navbar_items)
7
7
  disable_google_analytics = GovukAdminTemplate::Config.disable_google_analytics
8
+ allow_google_analytics_stub = (Rails.env.development? || (Rails.env.test? && GovukAdminTemplate::Config.enable_google_analytics_in_tests))
8
9
  %>
9
10
  <!DOCTYPE html>
10
11
  <!--[if lte IE 7]><html class="no-js lte-ie7" lang="en"><![endif]-->
@@ -121,15 +122,17 @@
121
122
 
122
123
  ga('create', 'UA-26179049-6', '<%= ENV.fetch('GOVUK_APP_DOMAIN') %>');
123
124
  ga('set', 'anonymizeIp', true);
125
+ <%= content_for(:before_pageview_js) %>
124
126
  <% if content_for?(:custom_pageview_fullpath) %>
125
127
  GOVUKAdmin.trackPageview('<%= content_for(:custom_pageview_fullpath) %>');
126
128
  <% else %>
127
129
  ga('send', 'pageview');
128
130
  <% end %>
129
131
  </script>
130
- <% elsif Rails.env.development? %>
132
+ <% elsif allow_google_analytics_stub %>
131
133
  <script>
132
134
  if (console) {window.ga = function() {console.log.apply(console, arguments);};}
135
+ <%= content_for(:before_pageview_js) %>
133
136
  </script>
134
137
  <% end %>
135
138
  <% end %>
@@ -19,5 +19,9 @@ module GovukAdminTemplate
19
19
  # Disable analytics
20
20
  # Default: false
21
21
  mattr_accessor :disable_google_analytics
22
+
23
+ # Enable analytics in tests
24
+ # Default: false
25
+ mattr_accessor :enable_google_analytics_in_tests
22
26
  end
23
27
  end
@@ -1,3 +1,3 @@
1
1
  module GovukAdminTemplate
2
- VERSION = "6.1.0".freeze
2
+ VERSION = "6.2.0".freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govuk_admin_template
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.1.0
4
+ version: 6.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - GOV.UK Dev
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-18 00:00:00.000000000 Z
11
+ date: 2017-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails