<commit_before>globals = require 'globals'
isLoggedIn = require './isLoggedIn'

trackEligible = ->

  return analytics? and globals.config.logToExternal

# Access control wrapper around segmentio object.
module.exports = exports = (args...) ->

  return  unless trackEligible()

  # send event#action as event for GA
  if args.length > 1
    {action} = args[1]
    args[1].event = args[0]  unless args[1].event

  # if event#action, send that or fallback to event
  event = if action? then action else args[0]
  analytics.track event, args[1]

exports.alias = (args...) ->

  return  unless trackEligible()
  analytics.alias args...
<commit_msg>Refactor `trackEvent` utility function as a wrapper<commit_after>remote  = require('app/remote').getInstance()
globals = require 'globals'

isLoggedIn = require './isLoggedIn'

trackEligible = ->

  return analytics? and globals.config.logToExternal

# Access control wrapper around segmentio object.
module.exports = exports = (action, properties) ->

  return  unless trackEligible()

  remote.api.Tracker.track action, properties
{'fraction_non_alphanumeric': 0.11049210770659239, 'fraction_numerical': 0.0064995357474466105, 'mean_word_length': 4.109004739336493, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2121890', 'n_tokens_mistral': 329, 'n_tokens_neox': 321, 'n_words': 98}