How to use the insight.prototype function in insight

To help you get started, we’ve selected a few insight examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github apache / cordova-cli / spec / cli.spec.js View on Github external
beforeEach(() => {
            // Allow testing if we _really_ would send tracking requests
            telemetry.track.and.callThrough();
            telemetry.turnOn.and.callThrough();
            telemetry.turnOff.and.callThrough();
            spyOn(Insight.prototype, 'track').and.callThrough();
            spyOn(Insight.prototype, '_save');
            spyOnProperty(Insight.prototype, 'optOut', 'get')
                .and.callFake(() => isOptedOut);
            spyOnProperty(Insight.prototype, 'optOut', 'set')
                .and.callFake(x => { isOptedOut = x; });

            // Set a normal opted-in user as default
            spyOn(telemetry, 'isCI').and.returnValue(false);
            isOptedOut = false;
        });
github apache / cordova-cli / spec / telemetry.spec.js View on Github external
beforeEach(() => {
        telemetry = rewire('../src/telemetry');
        insight = telemetry.__get__('insight');

        // Prevent any settings from being persisted during testing
        insight.config = {
            get (key) { return this[key]; },
            set (key, val) { this[key] = val; }
        };
        for (const key in insight.config) {
            spyOn(insight.config, key).and.callThrough();
        }

        // Prevent tracking anything during testing
        spyOn(Insight.prototype, '_save');

        // Prevent prompts during testing
        spyOn(Insight.prototype, 'askPermission');
    });
github release-it / release-it / lib / tracker.js View on Github external
}
    callback();
};

Insight.prototype._track = function() {
    if (this._options['dry-run']) {
        if(!stopTracking) {
            this.track('dry-run');
            stopTracking = true;
        }
    } else {
        this.track.apply(this, arguments);
    }
};

Insight.prototype.askPermissionAndTrack = function(options) {
    this._options = options;
    return when.promise(function(resolve) {
        if (this.optOut === undefined) {
            this.askPermission(null, function() {
                this._initialTrack(resolve);
            }.bind(this));
        } else {
            this._initialTrack(resolve);
        }
    }.bind(this));
};

module.exports = new Insight({
    trackingCode: 'UA-65084890-1',
    pkg: pkg
});
github release-it / release-it / lib / tracker.js View on Github external
var stopTracking;

Insight.prototype._initialTrack = function(callback) {
    if (!this.optOut) {
        this._track(
            'config',
            this._options['non-interactive'] ? 'non-interactive' : 'interactive',
            this._options.increment,
            this._options.dist.repo ? 'distRepo' : 'no-distRepo',
            this._options.npm.private ? 'private' : 'public'
        );
    }
    callback();
};

Insight.prototype._track = function() {
    if (this._options['dry-run']) {
        if(!stopTracking) {
            this.track('dry-run');
            stopTracking = true;
        }
    } else {
        this.track.apply(this, arguments);
    }
};

Insight.prototype.askPermissionAndTrack = function(options) {
    this._options = options;
    return when.promise(function(resolve) {
        if (this.optOut === undefined) {
            this.askPermission(null, function() {
                this._initialTrack(resolve);
github release-it / release-it / lib / tracker.js View on Github external
var Insight = require('insight'),
    when = require('when'),
    pkg = require('../package.json');

var stopTracking;

Insight.prototype._initialTrack = function(callback) {
    if (!this.optOut) {
        this._track(
            'config',
            this._options['non-interactive'] ? 'non-interactive' : 'interactive',
            this._options.increment,
            this._options.dist.repo ? 'distRepo' : 'no-distRepo',
            this._options.npm.private ? 'private' : 'public'
        );
    }
    callback();
};

Insight.prototype._track = function() {
    if (this._options['dry-run']) {
        if(!stopTracking) {
            this.track('dry-run');
github apache / cordova-cli / spec / cli.spec.js View on Github external
return cli(['node', 'cordova', 'platform', 'add', 'ios']).then(() => {
                expect(telemetry.track).toHaveBeenCalledWith('platform', 'add', 'successful');
                expect(Insight.prototype.track).toHaveBeenCalled();
                expect(Insight.prototype._save).toHaveBeenCalled();
            });
        });
github apache / cordova-cli / spec / telemetry.spec.js View on Github external
beforeEach(() => {
            spyOn(Insight.prototype, 'track');
        });

insight

Understand how your tool is being used by anonymously reporting usage metrics to Google Analytics or Yandex.Metrica

BSD-2-Clause
Latest version published 3 years ago

Package Health Score

56 / 100
Full package analysis

Popular insight functions