Skip to content

Commit

Permalink
Add integration satismeter
Browse files Browse the repository at this point in the history
  • Loading branch information
SegmentDestinationsBot committed Dec 10, 2019
1 parent 821fc5d commit 1f4045b
Show file tree
Hide file tree
Showing 6 changed files with 481 additions and 0 deletions.
41 changes: 41 additions & 0 deletions integrations/satismeter/HISTORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
2.0.1 / 2017-04-11
==================

* Send all user traits inside "traits" key

2.0.0 / 2016-06-21
==================

* Remove Duo compatibility
* Add CI setup (coverage, linting, cross-browser compatibility, etc.)
* Update eslint configuration

1.0.5 / 2016-06-15
==================

* support apiKey as a new name for token option

1.0.4 / 2016-05-07
==================

* Bump Analytics.js core, tester, integration to use Facade 2.x

1.0.3 / 2016-04-26
==================

* support page calls

1.0.2 / 2015-06-30
==================

* Replace analytics.js dependency with analytics.js-core

1.0.1 / 2015-06-24
==================

* Bump analytics.js-integration version

1.0.0 / 2015-06-09
==================

* Initial commit :sparkles:
12 changes: 12 additions & 0 deletions integrations/satismeter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# analytics.js-integration-satismeter [![Build Status][ci-badge]][ci-link]

Satismeter integration for [Analytics.js][].

## License

Released under the [MIT license](LICENSE).


[Analytics.js]: https://segment.com/docs/libraries/analytics.js/
[ci-link]: https://circleci.com/gh/segment-integrations/analytics.js-integration-satismeter
[ci-badge]: https://circleci.com/gh/segment-integrations/analytics.js-integration-satismeter.svg?style=svg
73 changes: 73 additions & 0 deletions integrations/satismeter/lib/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
'use strict';

/**
* Module dependencies.
*/

var integration = require('@segment/analytics.js-integration');
var when = require('do-when');

/**
* Expose `SatisMeter` integration.
*/

var SatisMeter = module.exports = integration('SatisMeter')
.global('satismeter')
.option('token', '')
.option('apiKey', '')
.tag('<script src="https://app.satismeter.com/satismeter.js">');

/**
* Initialize.
*
* @api public
*/

SatisMeter.prototype.initialize = function() {
var self = this;
this.load(function() {
when(function() { return self.loaded(); }, self.ready);
});
};

/**
* Loaded?
*
* @api private
* @return {boolean}
*/

SatisMeter.prototype.loaded = function() {
return !!window.satismeter;
};

/**
* Identify.
*
* @api public
* @param {Identify} identify
*/

SatisMeter.prototype.identify = function(identify) {
window.satismeter({
writeKey: this.options.apiKey || this.options.token,
userId: identify.userId(),
traits: this.analytics.user().traits(),
type: 'identify'
});
};

/**
* Page.
*
* @api public
* @param {Page} page
*/

SatisMeter.prototype.page = function() {
window.satismeter({
writeKey: this.options.apiKey || this.options.token,
userId: this.analytics.user().id(),
type: 'page'
});
};
54 changes: 54 additions & 0 deletions integrations/satismeter/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"name": "@segment/analytics.js-integration-satismeter",
"description": "The Satismeter analytics.js integration.",
"version": "2.0.1",
"keywords": [
"analytics.js",
"analytics.js-integration",
"segment",
"satismeter"
],
"main": "lib/index.js",
"scripts": {
"test": "make test"
},
"author": "Segment \u003cfriends@segment.com\u003e",
"license": "SEE LICENSE IN LICENSE",
"homepage": "https://github.com/segmentio/analytics.js-integrations/blob/master/integrations/satismeter#readme",
"bugs": {
"url": "https://github.com/segmentio/analytics.js-integrations/issues"
},
"repository": {
"type": "git",
"url": "git+https://github.com/segmentio/analytics.js-integrations.git"
},
"dependencies": {
"@segment/analytics.js-integration": "^2.1.0",
"do-when": "^1.0.0"
},
"devDependencies": {
"@segment/analytics.js-core": "^3.0.0",
"@segment/analytics.js-integration-tester": "^3.1.0",
"@segment/clear-env": "^2.0.0",
"@segment/eslint-config": "^3.1.1",
"browserify": "^13.0.0",
"browserify-istanbul": "^2.0.0",
"eslint": "^2.9.0",
"eslint-plugin-mocha": "^2.2.0",
"eslint-plugin-require-path-exists": "^1.1.5",
"istanbul": "^0.4.3",
"karma": "1.3.0",
"karma-browserify": "^5.0.4",
"karma-chrome-launcher": "^1.0.1",
"karma-coverage": "^1.0.0",
"karma-junit-reporter": "^1.0.0",
"karma-mocha": "1.0.1",
"karma-phantomjs-launcher": "^1.0.0",
"karma-sauce-launcher": "^1.0.0",
"karma-spec-reporter": "0.0.26",
"mocha": "^2.2.5",
"npm-check": "^5.2.1",
"phantomjs-prebuilt": "^2.1.7",
"watchify": "^3.7.0"
}
}
3 changes: 3 additions & 0 deletions integrations/satismeter/test/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "@segment/eslint-config/mocha"
}

0 comments on commit 1f4045b

Please sign in to comment.