Skip to content

Commit 0060537

Browse files
Add integration get-satisfaction This commit copies the content of the integration repo into the "integrations" folder. Original repo: https://github.com/segment-integrations/analytics.js-integration-get-satisfaction Readme: https://github.com/segment-integrations/analytics.js-integration-get-satisfaction/blob/master/README.md
1 parent 20597ac commit 0060537

File tree

6 files changed

+212
-0
lines changed

6 files changed

+212
-0
lines changed
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
2.0.0 / 2016-06-21
2+
==================
3+
4+
* Remove Duo compatibility
5+
* Add CI setup (coverage, linting, cross-browser compatibility, etc.)
6+
* Update eslint configuration
7+
8+
1.0.5 / 2016-05-07
9+
==================
10+
11+
* Bump Analytics.js core, tester, integration to use Facade 2.x
12+
13+
1.0.4 / 2015-06-30
14+
==================
15+
16+
* Replace analytics.js dependency with analytics.js-core
17+
18+
1.0.3 / 2015-06-30
19+
==================
20+
21+
* Replace analytics.js dependency with analytics.js-core
22+
23+
1.0.2 / 2015-06-24
24+
==================
25+
26+
* Bump analytics.js-integration version
27+
28+
1.0.1 / 2015-06-24
29+
==================
30+
31+
* Bump analytics.js-integration version
32+
33+
1.0.0 / 2015-06-09
34+
==================
35+
36+
* Initial commit :sparkles:
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# analytics.js-integration-get-satisfaction [![Build Status][ci-badge]][ci-link]
2+
3+
Get Satisfaction integration for [Analytics.js][].
4+
5+
## License
6+
7+
Released under the [MIT license](LICENSE).
8+
9+
10+
[Analytics.js]: https://segment.com/docs/libraries/analytics.js/
11+
[ci-link]: https://circleci.com/gh/segment-integrations/analytics.js-integration-get-satisfaction
12+
[ci-badge]: https://circleci.com/gh/segment-integrations/analytics.js-integration-get-satisfaction.svg?style=svg
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
'use strict';
2+
/**
3+
* Module dependencies.
4+
*/
5+
6+
var integration = require('@segment/analytics.js-integration');
7+
var onBody = require('on-body-ready');
8+
9+
/**
10+
* Expose `GetSatisfaction` integration.
11+
*/
12+
13+
var GetSatisfaction = module.exports = integration('Get Satisfaction')
14+
.assumesPageview()
15+
.global('GSFN')
16+
.option('widgetId', '')
17+
.tag('<script src="https://loader.engage.gsfn.us/loader.js">');
18+
19+
/**
20+
* Initialize.
21+
*
22+
* https://console.getsatisfaction.com/start/101022?signup=true#engage
23+
*
24+
* @api public
25+
*/
26+
27+
GetSatisfaction.prototype.initialize = function() {
28+
var self = this;
29+
var widget = this.options.widgetId;
30+
var div = document.createElement('div');
31+
var id = div.id = 'getsat-widget-' + widget;
32+
onBody(function(body) { body.appendChild(div); });
33+
34+
// usually the snippet is sync, so wait for it before initializing the tab
35+
this.load(function() {
36+
window.GSFN.loadWidget(widget, { containerId: id });
37+
self.ready();
38+
});
39+
};
40+
41+
/**
42+
* Loaded?
43+
*
44+
* @api private
45+
* @return {boolean}
46+
*/
47+
48+
GetSatisfaction.prototype.loaded = function() {
49+
return !!window.GSFN;
50+
};
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
{
2+
"name": "@segment/analytics.js-integration-get-satisfaction",
3+
"description": "The Get Satisfaction analytics.js integration.",
4+
"version": "2.0.0",
5+
"keywords": [
6+
"analytics.js",
7+
"analytics.js-integration",
8+
"segment",
9+
"get-satisfaction"
10+
],
11+
"main": "lib/index.js",
12+
"scripts": {
13+
"test": "make test"
14+
},
15+
"author": "Segment \u003cfriends@segment.com\u003e",
16+
"license": "SEE LICENSE IN LICENSE",
17+
"homepage": "https://github.com/segmentio/analytics.js-integrations/blob/master/integrations/get-satisfaction#readme",
18+
"bugs": {
19+
"url": "https://github.com/segmentio/analytics.js-integrations/issues"
20+
},
21+
"repository": {
22+
"type": "git",
23+
"url": "git+https://github.com/segmentio/analytics.js-integrations.git"
24+
},
25+
"dependencies": {
26+
"@segment/analytics.js-integration": "^2.1.0",
27+
"on-body-ready": "^1.0.0"
28+
},
29+
"devDependencies": {
30+
"@segment/analytics.js-core": "^3.0.0",
31+
"@segment/analytics.js-integration-tester": "^3.1.0",
32+
"@segment/clear-env": "^2.0.0",
33+
"@segment/eslint-config": "^3.1.1",
34+
"browserify": "^13.0.0",
35+
"browserify-istanbul": "^2.0.0",
36+
"eslint": "^2.9.0",
37+
"eslint-plugin-mocha": "^2.2.0",
38+
"eslint-plugin-require-path-exists": "^1.1.5",
39+
"istanbul": "^0.4.3",
40+
"karma": "1.3.0",
41+
"karma-browserify": "^5.0.4",
42+
"karma-chrome-launcher": "^1.0.1",
43+
"karma-coverage": "^1.0.0",
44+
"karma-junit-reporter": "^1.0.0",
45+
"karma-mocha": "1.0.1",
46+
"karma-phantomjs-launcher": "^1.0.0",
47+
"karma-sauce-launcher": "^1.0.0",
48+
"karma-spec-reporter": "0.0.26",
49+
"mocha": "^2.2.5",
50+
"npm-check": "^5.2.1",
51+
"phantomjs-prebuilt": "^2.1.7",
52+
"watchify": "^3.7.0"
53+
}
54+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"extends": "@segment/eslint-config/mocha"
3+
}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
'use strict';
2+
3+
var Analytics = require('@segment/analytics.js-core').constructor;
4+
var integration = require('@segment/analytics.js-integration');
5+
var sandbox = require('@segment/clear-env');
6+
var tester = require('@segment/analytics.js-integration-tester');
7+
var GetSatisfaction = require('../lib/');
8+
9+
describe('Get Satisfaction', function() {
10+
var analytics;
11+
var gs;
12+
var options = {
13+
widgetId: 5005
14+
};
15+
16+
beforeEach(function() {
17+
analytics = new Analytics();
18+
gs = new GetSatisfaction(options);
19+
analytics.use(GetSatisfaction);
20+
analytics.use(tester);
21+
analytics.add(gs);
22+
});
23+
24+
afterEach(function() {
25+
analytics.restore();
26+
analytics.reset();
27+
gs.reset();
28+
sandbox();
29+
});
30+
31+
it('should have the right settings', function() {
32+
analytics.compare(GetSatisfaction, integration('Get Satisfaction')
33+
.assumesPageview()
34+
.global('GSFN')
35+
.option('widgetId', ''));
36+
});
37+
38+
describe('before loading', function() {
39+
beforeEach(function() {
40+
analytics.stub(gs, 'load');
41+
});
42+
43+
describe('#initialize', function() {
44+
it('should add the get satisfaction widget to the dom', function() {
45+
analytics.initialize();
46+
analytics.page();
47+
analytics.assert(document.getElementById('getsat-widget-' + options.widgetId));
48+
});
49+
});
50+
});
51+
52+
describe('loading', function() {
53+
it('should load', function(done) {
54+
analytics.load(gs, done);
55+
});
56+
});
57+
});

0 commit comments

Comments
 (0)