Sha256: 573b33373fb6c0654239e1931b4e4413651d8201f7f45a4ebc5bc08894d33ec9
Contents?: true
Size: 1.19 KB
Versions: 1
Compression:
Stored size: 1.19 KB
Contents
(function($) { function trackLinkClick(action, $element) { var linkText = $.trim($element.text()); var linkURL = $element.attr('href'); var label = linkText + '|' + linkURL; ga( 'send', 'event', 'SM Technical Documentation', // Event Category action, // Event Action label // Event Label ); } function linkTrackingEventHandler(action) { return function() { trackLinkClick(action, $(this)); }; }; function catchBrokenFragmentLinks() { var fragment = window.location.hash; var $target = $(fragment); if(!$target.get(0)) { ga( 'send', 'event', 'Broken fragment ID', // Event Category 'pageview', // Event Action window.location.pathname + fragment // Event Label ); } } $(document).on('ready', function() { if (typeof ga === 'undefined') { return; } $('.technical-documentation a').on('click', linkTrackingEventHandler('inTextClick')); $('.header a').on('click', linkTrackingEventHandler('topNavigationClick')); $('.toc a').on('click', linkTrackingEventHandler('tableOfContentsNavigationClick')); catchBrokenFragmentLinks(); }); })(jQuery);
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
govuk_tech_docs-1.5.0 | lib/assets/javascripts/_analytics.js |