<commit_before>import config from './config'
import { getName, getListId, warn } from './utils'
import ga from './ga'
import features from './features/index'
import loadScript from 'load-script'

export default function init (router, callback) {
  if (config.manual) {
    return
  }

  if (!config.id || !config.id.length) {
    const url = 'https://github.com/MatteoGabriele/vue-analytics#usage'
    warn('Please enter a Google Analaytics tracking ID', url)
    return
  }

  const options = config.userId || {}
  const debugSource = config.debug.enabled ? '_debug' : ''
  const source = `https://www.google-analytics.com/analytics${debugSource}.js`

  loadScript(source, function (error, script) {
    if (error) {
      warn('Ops! Could\'t load the Google Analytics script')
      return
    }

    const poll = setInterval(function () {
      if (!window.ga) {
        return
      }

      clearInterval(poll)

      if (config.debug.enabled) {
        window.ga_debug = {
          trace: config.debug.trace
        }
      }

      const ids = getListId()

      ids.forEach(function (id) {
        if (ids.length > 1) {
          // we need to register the name used by the ga methods so that
          // when a method is used Google knows which account did it<commit_msg>fix(init): typo in the warning message<commit_after>import config from './config'
import { getName, getListId, warn } from './utils'
import ga from './ga'
import features from './features/index'
import loadScript from 'load-script'

export default function init (router, callback) {
  if (config.manual) {
    return
  }

  if (!config.id || !config.id.length) {
    const url = 'https://github.com/MatteoGabriele/vue-analytics#usage'
    warn('Please enter a Google Analaytics tracking ID', url)
    return
  }

  const options = config.userId || {}
  const debugSource = config.debug.enabled ? '_debug' : ''
  const source = `https://www.google-analytics.com/analytics${debugSource}.js`

  loadScript(source, function (error, script) {
    if (error) {
      warn('Ops! Is not possible to load Google Analytics script')
      return
    }

    const poll = setInterval(function () {
      if (!window.ga) {
        return
      }

      clearInterval(poll)

      if (config.debug.enabled) {
        window.ga_debug = {
          trace: config.debug.trace
        }
      }

      const ids = getListId()

      ids.forEach(function (id) {
        if (ids.length > 1) {
          // we need to register the name used by the ga methods so that
          // when a method is used Google knows which account did it
{'fraction_non_alphanumeric': 0.11753371868978806, 'fraction_numerical': 0.0007707129094412332, 'mean_word_length': 2.561042524005487, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 2, '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': '6218531', 'n_tokens_mistral': 776, 'n_tokens_neox': 751, 'n_words': 234}