Sha256: 81db3a3692f7891a30cad217f817d6ba654becb99382438d448a79c688bd64f8

Contents?: true

Size: 649 Bytes

Versions: 4

Compression:

Stored size: 649 Bytes

Contents

window.GOVUK.Modules = window.GOVUK.Modules || {};

(function (Modules) {
  'use strict'

  Modules.GemTrackShareButtonClicks = function () {
    this.start = function (element) {
      element.on('click', '.js-share-facebook', trackFacebook)
      element.on('click', '.js-share-twitter', trackTwitter)

      function trackFacebook () {
        trackShare('facebook')
      }

      function trackTwitter () {
        trackShare('twitter')
      }

      function trackShare (network) {
        if (GOVUK.analytics && GOVUK.analytics.trackShare) {
          GOVUK.analytics.trackShare(network)
        }
      }
    }
  }
})(window.GOVUK.Modules)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
govuk_publishing_components-8.2.0 app/assets/javascripts/govuk_publishing_components/lib/track-share-button-clicks.js
govuk_publishing_components-8.1.0 app/assets/javascripts/govuk_publishing_components/lib/track-share-button-clicks.js
govuk_publishing_components-8.0.1 app/assets/javascripts/govuk_publishing_components/lib/track-share-button-clicks.js
govuk_publishing_components-8.0.0 app/assets/javascripts/govuk_publishing_components/lib/track-share-button-clicks.js