Sha256: 0d713800256b0cf87f986b01c58aeff41fdf7914312cf1b56510d3a78d2ebda3
Contents?: true
Size: 969 Bytes
Versions: 131
Compression:
Stored size: 969 Bytes
Contents
;(function (global) { 'use strict' var $ = global.jQuery var GOVUK = global.GOVUK || {} GOVUK.analyticsPlugins = GOVUK.analyticsPlugins || {} GOVUK.analyticsPlugins.downloadLinkTracker = function (options) { options = options || {} var downloadLinkSelector = options.selector if (downloadLinkSelector) { $('body').on('click', downloadLinkSelector, trackDownload) } function trackDownload (evt) { var $link = getLinkFromEvent(evt) var href = $link.attr('href') var evtOptions = { transport: 'beacon' } var linkText = $.trim($link.text()) if (linkText) { evtOptions.label = linkText } GOVUK.analytics.trackEvent('Download Link Clicked', href, evtOptions) } function getLinkFromEvent (evt) { var $target = $(evt.target) if (!$target.is('a')) { $target = $target.parents('a') } return $target } } global.GOVUK = GOVUK })(window)
Version data entries
131 entries across 131 versions & 1 rubygems