Sha256: ea7a10ecac554d9f1dfcf856ab95ecba3d080dcf8b6c4f03c0e9a4394c69ae1d
Contents?: true
Size: 987 Bytes
Versions: 168
Compression:
Stored size: 987 Bytes
Contents
//= require ../vendor/polyfills/closest.js ;(function (global) { 'use strict' var GOVUK = global.GOVUK || {} GOVUK.analyticsPlugins = GOVUK.analyticsPlugins || {} GOVUK.analyticsPlugins.mailtoLinkTracker = function () { document.querySelector('body').addEventListener('click', function (event) { var element = event.target if (element.tagName !== 'A') { element = element.closest('a') } if (!element) { return } var href = element.getAttribute('href') if (!href) { return } if (href.substring(0, 7) === 'mailto:') { trackClickEvent(element, href) } }) function trackClickEvent (element, href) { var options = { transport: 'beacon' } var linkText = element.textContent if (linkText) { options.label = linkText.trim() } GOVUK.analytics.trackEvent('Mailto Link Clicked', href, options) } } global.GOVUK = GOVUK })(window)
Version data entries
168 entries across 168 versions & 1 rubygems