       {firstName, lastName, nickname} = profile
 
       # register user to mixpanel
-      mixpanel?.identify nickname
-      mixpanel?.people.set
+      mixpanel.identify nickname
+      mixpanel.people.set
         "$username"     : nickname
         "$first_name"   : firstName
         "$last_name"    : lastName

if KD.config.logToExternal then do ->
  KD.getSingleton('mainController').on "AccountChanged", (account) ->
    return  unless KD.isLoggedIn()
    return  unless account

    account.fetchEmail (err, email)->
      console.log err  if err

        "$created"      : createdAt
        "Status"        : type
        "Randomizer"    : KD.utils.getRandomNumber 4
      mixpanel.name_tag "#{nickname}.kd.io"

# Access control wrapper around mixpanel object.
KD.mixpanel = (args...)->
  return  unless mixpanel
  mixpanel.track args...  if KD.config.logToExternal

KD.mixpanel.alias = (args...)->
  return  unless mixpanel
  mixpanel.alias args...
