 loadUrlShortenerSaveEvents = ->
   $('input[name="enabled_shortener"]').change ->
     store.modify 'bitly', 'googl', 'yourls', (data, key) ->
-      data.enabled = $("##{key}").is ':checked'
+      if data.enabled = $("##{key}").is ':checked'
+        shortener = ext.queryUrlShortener (shortener) ->
+          shortener.name is key
+        analytics.track 'Shorteners', 'Enabled', shortener.title
   bindSaveEvent '#bitlyApiKey, #bitlyUsername', 'input', 'bitly', ->
     @val().trim()
   bindSaveEvent '#googlOauth', 'change', 'googl', ->
     @is ':checked'
+  , (jel, key, value) ->
+    analytics.track 'Shorteners', 'Changed', 'goo.gl OAuth',
+      if value then 1 else 0
   bindSaveEvent "#yourlsPassword, #yourlsSignature, #yourlsUrl,
    #yourlsUsername", 'input', 'yourls', ->
     @val().trim()

# Bind the event handlers required for persisting toolbar behaviour changes.
loadToolbarSaveEvents = ->
  $('input[name="toolbar_behaviour"]').change ->
    store.modify 'toolbar', (toolbar) ->
      toolbar.popup = $('#toolbarPopup').is ':checked'
    ext.updateToolbar()
  bindSaveEvent '#toolbarClose, #toolbarKey, #toolbarStyle', 'change',
   'toolbar', (key) ->
    if key is 'key' then @val() else @is ':checked'
  , ext.updateToolbar

# Update the URL shorteners section of the options page with the current
# settings.

      footer:
        opt_footer: "#{new Date().getFullYear()}"
    # Bind tab selection event to all tabs.
    initialTabChange = yes
    $('[tabify]').click ->
      $this = $ this
      unless $this.hasClass 'selected'
        $this.siblings().removeClass 'selected'
        $this.addClass 'selected'
        $($this.attr 'tabify').show().siblings('.tab').hide()
        store.set 'options_active_tab', id = $this.attr 'id'
        unless initialTabChange
          id = id.match(/(\S*)_nav$/)[1]
          id = id[0].toUpperCase() + id.substr 1
          analytics.track 'Tabs', 'Changed', id
        initialTabChange = no
    # Reflect the persisted tab.
    store.init 'options_active_tab', 'general_nav'
    $("##{store.get 'options_active_tab'}").click()
