 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 importing templates.
loadTemplateImportEvents = ->
  templates = $ '#templates'
  # Restore the previous view in the import process.
  $('.import_back_btn').live 'click', ->

  $('.delete_yes_btn').live 'click', ->
    opt = templates.find 'option:selected'
    if opt.data('readOnly') isnt 'true'
      title = opt.text()
      opt.remove()
      templates.change().focus()
      saveTemplates()
      analytics.track 'Templates', 'Deleted', title
    $(document).trigger 'close.facebox'
    updateToolbarTemplates()
  # Move the selected option down once when the *Down* control is clicked.
