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 +4 -4
- data/CHANGELOG.md +4 -0
- data/JAVASCRIPT.md +1 -0
- data/app/assets/javascripts/govuk-admin-template/modules/track_click.js +19 -0
- data/app/views/govuk_admin_template/style_guide/index.html.erb +37 -0
- data/app/views/layouts/govuk_admin_template.html.erb +4 -0
- data/lib/govuk_admin_template/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2da4cdc6289a8ee886aa81882a5cbd7ae148bd2b
|
4
|
+
data.tar.gz: 2fdf20196a4ca95a87ca1629366626a47ab25df9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b8f2c6ba99a0fb45323ea8508dd473352baee9a6026b288d90f84578a79b9327b04165fb763af4734e1e01a8afaf2dfd4f22e2fdc9e40a56262515152123933d
|
7
|
+
data.tar.gz: 64c0bccfc9263304bde2e80d77089e7311b957b27190087106777fc7336b66aeed27c96837a106c64a843db2d51cbd4f9914e7a6490d7d6b8f30ba7fc54e4165
|
data/CHANGELOG.md
CHANGED
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"><div class="alert-success"
|
564
|
+
data-module="auto-track-event"
|
565
|
+
data-track-action="alert-success"
|
566
|
+
data-track-label="Logged in successfully">
|
567
|
+
Logged in successfully
|
568
|
+
</div></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"><div data-module="track-click" data-track-action="dialog-buttons">
|
586
|
+
<button class="js-track">Yes</button>
|
587
|
+
<a href="#" class="js-track" data-track-label="No">Get me out</a>
|
588
|
+
</div></pre>
|
589
|
+
</div>
|
590
|
+
</div>
|
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.
|
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-
|
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
|