govuk_admin_template 3.2.0 → 3.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d8b45722d3edde572beabb4220b028ef4830f294
4
- data.tar.gz: 4c7b2288a16fa72ecb293945ed9470fe36034f03
3
+ metadata.gz: 2da4cdc6289a8ee886aa81882a5cbd7ae148bd2b
4
+ data.tar.gz: 2fdf20196a4ca95a87ca1629366626a47ab25df9
5
5
  SHA512:
6
- metadata.gz: 774dd7c3f83ca6dbf5f0eda5ebbf5c770eee54d3a9df65203f2a6132d82772c53e0a2d2974b447975ca6a4ccab347474ef8d1dbd4a6ecb02a4901e6957b47357
7
- data.tar.gz: 679ad2d783007b3b6f6a64bd76f6710a1ed1e12039052dd7852849e49d362b114fded9ca0e7f6181fd24a2f62b7f5a375324ba4265439d229aad37d8fa9d13b3
6
+ metadata.gz: b8f2c6ba99a0fb45323ea8508dd473352baee9a6026b288d90f84578a79b9327b04165fb763af4734e1e01a8afaf2dfd4f22e2fdc9e40a56262515152123933d
7
+ data.tar.gz: 64c0bccfc9263304bde2e80d77089e7311b957b27190087106777fc7336b66aeed27c96837a106c64a843db2d51cbd4f9914e7a6490d7d6b8f30ba7fc54e4165
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 3.3.0
2
+
3
+ * Add track-click module for Analytics tracking of button clicks
4
+
1
5
  # 3.2.0
2
6
 
3
7
  * Enable sendBeacon for all admin analytics events
data/JAVASCRIPT.md CHANGED
@@ -104,3 +104,4 @@ confirm.js | `Confirm` | `confirm` | Show a [window.confirm](https://developer.m
104
104
  filterable_table.js | `FilterableTable` | `filterable-table` | Filter the contents of a table, showing only matching rows
105
105
  fixed_table_header.js | `FixedTableHeader` | `fixed-table-header` | Fix the `<thead>` portion of a table when scrolling offscreen
106
106
  toggle.js | `Toggle` | `toggle` | A simple toggle
107
+ track_click.js | `TrackClick` | `track-click` | Track button clicks in Google Anayltics using `sendBeacon`
@@ -0,0 +1,19 @@
1
+ (function(Modules) {
2
+ "use strict";
3
+
4
+ Modules.TrackClick = function() {
5
+ var that = this;
6
+
7
+ that.start = function(container) {
8
+ var trackClick = function() {
9
+ var action = container.data("track-action") || "button-pressed",
10
+ label = $(this).data("track-label") || $(this).text();
11
+
12
+ GOVUKAdmin.trackEvent(action, label);
13
+ };
14
+
15
+ container.on("click", ".js-track", trackClick);
16
+ }
17
+ };
18
+
19
+ })(window.GOVUKAdmin.Modules);
@@ -551,3 +551,40 @@
551
551
  </div>
552
552
  </div>
553
553
  <hr>
554
+
555
+ <h2>Analytics</h2>
556
+ <div class="row">
557
+ <div class="col-md-6">
558
+ <h3>Auto Track Events</h3>
559
+ <p>Adding this module to a page will cause an event to be sent to Google Analytics with
560
+ a specified action, label and value</p>
561
+ </div>
562
+ <div class="col-md-6">
563
+ <pre class="add-top-margin">&lt;div class=&quot;alert-success&quot;
564
+ data-module=&quot;auto-track-event&quot;
565
+ data-track-action=&quot;alert-success&quot;
566
+ data-track-label=&quot;Logged in successfully&quot;&gt;
567
+ Logged in successfully
568
+ &lt;/div&gt;</pre>
569
+ </div>
570
+ </div>
571
+ <div class="row">
572
+ <div class="col-md-6">
573
+ <h3>Track Click</h3>
574
+ <p>This module is intended as an easy way to track individual button/link
575
+ clicks as events in Google Analytics. Groups of buttons may end up
576
+ redirecting to the same place, meaning they’re not trackable via URLs
577
+ in GA. This will use the sendBeacon functionality to fire off an event
578
+ once the button has been clicked and during navigation.</p>
579
+ <p>The module should be added to the container of the buttons, where the
580
+ GA action can be changed from the default of <code>button-pressed</code> using the
581
+ <code>data-track-action</code> attribute. The label defaults to the link/button
582
+ text, but can be overridden with <code>data-track-label</code>.</p>
583
+ </div>
584
+ <div class="col-md-6">
585
+ <pre class="add-top-margin">&lt;div data-module=&quot;track-click&quot; data-track-action=&quot;dialog-buttons&quot;&gt;
586
+ &lt;button class=&quot;js-track&quot;&gt;Yes&lt;/button&gt;
587
+ &lt;a href=&quot;#&quot; class=&quot;js-track&quot; data-track-label=&quot;No&quot;&gt;Get me out&lt;/a&gt;
588
+ &lt;/div&gt;</pre>
589
+ </div>
590
+ </div>
@@ -108,6 +108,10 @@
108
108
  ga('set', 'anonymizeIp', true);
109
109
  ga('send', 'pageview');
110
110
  </script>
111
+ <% else %>
112
+ <script>
113
+ if (console) {window.ga = function() {console.log.apply(console, arguments);};}
114
+ </script>
111
115
  <% end %>
112
116
  <% end %>
113
117
  </body>
@@ -1,3 +1,3 @@
1
1
  module GovukAdminTemplate
2
- VERSION = "3.2.0"
2
+ VERSION = "3.3.0"
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: 3.2.0
4
+ version: 3.3.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: 2015-10-30 00:00:00.000000000 Z
11
+ date: 2015-11-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -149,6 +149,7 @@ files:
149
149
  - app/assets/javascripts/govuk-admin-template/modules/fixed_table_header.js
150
150
  - app/assets/javascripts/govuk-admin-template/modules/radio_toggle.js
151
151
  - app/assets/javascripts/govuk-admin-template/modules/toggle.js
152
+ - app/assets/javascripts/govuk-admin-template/modules/track_click.js
152
153
  - app/assets/javascripts/govuk-admin-template/vendor/html5.js
153
154
  - app/assets/javascripts/govuk-admin-template/vendor/respond.min.js
154
155
  - app/assets/javascripts/lte-ie8.js