Skip to content

Commit

Permalink
Add integration simplereach
Browse files Browse the repository at this point in the history
  • Loading branch information
SegmentDestinationsBot committed Dec 10, 2019
1 parent 19fb9b9 commit 7b9a329
Show file tree
Hide file tree
Showing 7 changed files with 428 additions and 0 deletions.
52 changes: 52 additions & 0 deletions integrations/simplereach/HISTORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@

2.1.1 / 2016-10-06
==================

* Just a quick minor update.

2.1.0 / 2016-10-06
==================

* Now accepts the wonderful name of your track events :)

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

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

1.0.6 / 2016-05-07
==================

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

1.0.5 / 2015-09-11
==================

* add track function

1.0.4 / 2015-08-20
==================

* override default `__reach_config.url` property of `false`

1.0.3 / 2015-08-19
==================

* populate url and title in page call

1.0.2 / 2015-08-19
==================

* Updating name: Simplereach -> SimpleReach

1.0.1 / 2015-08-19
==================

* Initial implementation, adding to analytics.js

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

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

Simplereach 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-simplereach
[ci-badge]: https://circleci.com/gh/segment-integrations/analytics.js-integration-simplereach.svg?style=svg
86 changes: 86 additions & 0 deletions integrations/simplereach/lib/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
'use strict';

/**
* Module dependencies.
*/

var defaults = require('@ndhoule/defaults');
var integration = require('@segment/analytics.js-integration');

/**
* Expose `Simplereach` integration.
*/

var SimpleReach = module.exports = integration('SimpleReach')
.global('__reach_config')
.global('SPR')
.option('pid', '')
.tag('<script src="//d8rk54i4mohrb.cloudfront.net/js/reach.js">');

/**
* Initialize.
* http://www.simplereach.com/docs/#standardImplementation
* Some adjustments made to standard implementation
*
* @api public
*/

SimpleReach.prototype.initialize = function() {
window.__reach_config = window.__reach_config || {};
defaults(window.__reach_config, {
pid: this.options.pid,
reach_tracking: false
});
this.load(this.ready);
};

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

SimpleReach.prototype.loaded = function() {
return !!window.SPR;
};

/**
* Page.
*
* http://www.simplereach.com/docs/ajax/
*
* @api public
*/

SimpleReach.prototype.page = function(page) {
defaults(window.__reach_config, {
url: page.url(),
title: page.title()
});

if (window.__reach_config.url === false) {
window.__reach_config.url = page.url();
}

window.SPR.collect(window.__reach_config);
};

/**
* Page.
*
* http://www.simplereach.com/docs/ajax/
*
* @api public
*/
SimpleReach.prototype.track = function(track) {
window.SPR.collect({
pid: this.options.pid,
reach_tracking: false,
url: track.proxy('context.page.url'),
title: track.proxy('context.page.title'),
ctx_revenue: track.revenue(),
ctx_order_id: track.orderId(),
ctx_event_name: track.event()
});
};
54 changes: 54 additions & 0 deletions integrations/simplereach/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"name": "@segment/analytics.js-integration-simplereach",
"description": "The Simplereach analytics.js integration.",
"version": "2.1.1",
"keywords": [
"analytics.js",
"analytics.js-integration",
"segment",
"simplereach"
],
"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/simplereach#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": {
"@ndhoule/defaults": "^2.0.1",
"@segment/analytics.js-integration": "^2.1.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/simplereach/test/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "@segment/eslint-config/mocha"
}
Loading

0 comments on commit 7b9a329

Please sign in to comment.