<commit_before>
var callback = require('callback')
  , extend = require('extend')
  , integration = require('../integration')
  , load = require('load-script')
  , onError = require('on-error');


/**
 * Expose `Errorception` integration.
 *
 * https://github.com/amplitude/Errorception-Javascript
 */

var Errorception = module.exports = integration('Errorception');


/**
 * Required key.
 */

Errorception.prototype.key = 'projectId';


/**
 * Default options.
 */

Errorception.prototype.defaults = {
  // your errorception project id (required)
  projectId: '',
  // whether to store metadata about the user on `identify` calls
  // http://blog.errorception.com/2012/11/capture-custom-data-with-your-errors.html
  meta: true
};


/**
 * Initialize.
 *
 * @param {Object} options
 * @param {Function} ready
 */

Errorception.prototype.initialize = function (options, ready) {
  window._errs = [options.projectId];
  onError(function() {
    window._errs.push(arguments);
  });
  load('//beacon.errorception.com/' + options.projectId + '.js');
  callback.async(ready);
};


/**
 * Identify.
 *
 * @param {String} id (optional)
 * @param {Object} traits (optional)
 * @param {Object} options (optional)
 */

Errorception.prototype.identify = function (id, traits, options) {
  if (!this.options.meta) return;
  window._errs.meta || (window._errs.meta = {});
  if (id) traits.id = id;
  extend(window._errs.meta, traits);
};<commit_msg>errorception: convert to page<commit_after>
var callback = require('callback');
var extend = require('extend');
var integration = require('../integration');
var load = require('load-script');
var onError = require('on-error');


/**
 * Expose `Errorception` integration.
 *
 * https://github.com/amplitude/Errorception-Javascript
 */

var Errorception = module.exports = integration('Errorception');


/**
 * Default options.
 */

Errorception.prototype.defaults = {
  // your errorception project id (required)
  projectId: '',
  // whether to store metadata about the user on `identify` calls
  // http://blog.errorception.com/2012/11/capture-custom-data-with-your-errors.html
  meta: true
};


/**
 * Initialize.
 */

Errorception.prototype.initialize = function () {
  window._errs = [this.options.projectId];
  onError(function() {
    window._errs.push(arguments);
  });
  callback.async(this.ready);
};


/**
 * Load the Errorception library.
 *
 * @param {Function} callback
 */

Errorception.prototype.load = function (callback) {
  load('//beacon.errorception.com/' + this.options.projectId + '.js', callback);
};


/**
 * Identify.
 *
 * @param {String} id (optional)
 * @param {Object} traits (optional)
 * @param {Object} options (optional)
 */

Errorception.prototype.identify = function (id, traits, options) {
  if (!this.options.meta) return;
  if (id) traits.id = id;
  window._errs.meta = window._errs.meta || {};
  extend(window._errs.meta, traits);
};
{'fraction_non_alphanumeric': 0.1698178068064627, 'fraction_numerical': 0.004125128910278446, 'mean_word_length': 3.8580968280467447, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '906005', 'n_tokens_mistral': 926, 'n_tokens_neox': 901, 'n_words': 194}