govuk_frontend_toolkit
Advanced tools
Comparing version 7.1.0 to 7.2.0
@@ -0,1 +1,5 @@ | ||
# 7.2.0 | ||
- Add custom dimension on TrackEvent to duplicate the url information that we normally send on a the `event action`. This will be used to join up with a scheduled custom upload called "External Link Status". We can only join uploads on custom dimensions, not on `event actions`, where we normally add the url info. ([PR #436](alphagov/govuk_frontend_toolkit#436) and [PR #439](alphagov/govuk_frontend_toolkit#439)) | ||
# 7.1.0 | ||
@@ -2,0 +6,0 @@ |
@@ -8,3 +8,5 @@ ;(function (global) { | ||
GOVUK.analyticsPlugins = GOVUK.analyticsPlugins || {} | ||
GOVUK.analyticsPlugins.externalLinkTracker = function () { | ||
GOVUK.analyticsPlugins.externalLinkTracker = function (options) { | ||
options = options || {} | ||
var externalLinkUploadCustomDimension = options.externalLinkUploadCustomDimension | ||
var currentHost = GOVUK.analyticsPlugins.externalLinkTracker.getHostname() | ||
@@ -25,2 +27,13 @@ var externalLinkSelector = 'a[href^="http"]:not(a[href*="' + currentHost + '"])' | ||
if (externalLinkUploadCustomDimension !== undefined) { | ||
// This custom dimension will be used to duplicate the url information | ||
// that we normally send in an "event action". This will be used to join | ||
// up with a scheduled custom upload called "External Link Status". | ||
// We can only join uploads on custom dimensions, not on `event actions` | ||
// where we normally add the url info. | ||
var externalLinkToJoinUploadOn = href | ||
GOVUK.analytics.setDimension(externalLinkUploadCustomDimension, externalLinkToJoinUploadOn) | ||
} | ||
GOVUK.analytics.trackEvent('External Link Clicked', href, options) | ||
@@ -27,0 +40,0 @@ } |
{ | ||
"name": "govuk_frontend_toolkit", | ||
"version": "7.1.0", | ||
"version": "7.2.0", | ||
"description": "npm package for using the GOV.UK frontend toolkit", | ||
@@ -5,0 +5,0 @@ "repository": { |
487354
1607