Skip to content

Commit 22641fa

Browse files
committed
Init
1 parent 27af78d commit 22641fa

9 files changed

+21
-164
lines changed

Contributing.md

-55
This file was deleted.

History.md

-10
This file was deleted.

License.md

-23
This file was deleted.

Makefile

-10
Original file line numberDiff line numberDiff line change
@@ -78,16 +78,6 @@ test-browser: node_modules build.js
7878
@$(DUOT) browser --commands "make build" $(TESTS_DIR)
7979
.PHONY: test-browser
8080

81-
# Test in Sauce Labs. Note that you must set the SAUCE_USERNAME and
82-
# SAUCE_ACCESS_KEY environment variables using your Sauce Labs credentials.
83-
test-sauce: node_modules build.js
84-
@$(DUOT) saucelabs $(TESTS_DIR) \
85-
--name analytics.js-integrations \
86-
--browsers $(BROWSER) \
87-
--user $(SAUCE_USERNAME) \
88-
--key $(SAUCE_ACCESS_KEY)
89-
.PHONY: test-sauce
90-
9181
# Test shortcut.
9282
test: lint test-phantomjs
9383
.PHONY: test

Readme.md

+2-5
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
# analytics.js-integration-segmentio [![Build Status][ci-badge]][ci-link]
1+
# analytics.js-integration-attribution
22

3-
Segmentio integration for [Analytics.js][].
3+
Attribution integration for [Analytics.js][].
44

55
## License
66

77
Released under the [MIT license](License.md).
88

9-
109
[Analytics.js]: https://segment.com/docs/libraries/analytics.js/
11-
[ci-link]: https://circleci.com/gh/segment-integrations/analytics.js-integration-segmentio
12-
[ci-badge]: https://circleci.com/gh/segment-integrations/analytics.js-integration-segmentio.svg?style=svg

circle.yml

-11
This file was deleted.

component.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"name": "analytics.js-integration-segmentio",
3-
"repo": "segment-integrations/analytics.js-integration-segmentio",
2+
"name": "analytics.js-integration-attribution",
3+
"repo": "segment-integrations/analytics.js-integration-attribution",
44
"description": "The Segmentio analytics.js integration.",
55
"version": "1.0.1",
66
"license": "MIT",

lib/index.js

+14-40
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
* Module dependencies.
44
*/
55

6-
var ads = require('ad-params');
76
var clone = require('clone');
87
var cookie = require('cookie');
98
var extend = require('extend');
@@ -13,7 +12,6 @@ var localstorage = require('store');
1312
var protocol = require('protocol');
1413
var send = require('send-json');
1514
var topDomain = require('top-domain');
16-
var utm = require('utm-params');
1715
var uuid = require('uuid');
1816

1917
/**
@@ -28,10 +26,10 @@ var cookieOptions = {
2826
};
2927

3028
/**
31-
* Expose `Segment` integration.
29+
* Expose `Attribution` integration.
3230
*/
3331

34-
var Segment = exports = module.exports = integration('Segment.io')
32+
var Attribution = exports = module.exports = integration('Attribution')
3533
.option('apiKey', '');
3634

3735
/**
@@ -58,7 +56,7 @@ exports.global = window;
5856
* @api public
5957
*/
6058

61-
Segment.prototype.initialize = function() {
59+
Attribution.prototype.initialize = function() {
6260
var self = this;
6361
this.ready();
6462
this.analytics.on('invoke', function(msg) {
@@ -77,7 +75,7 @@ Segment.prototype.initialize = function() {
7775
* @return {boolean}
7876
*/
7977

80-
Segment.prototype.loaded = function() {
78+
Attribution.prototype.loaded = function() {
8179
return true;
8280
};
8381

@@ -88,7 +86,7 @@ Segment.prototype.loaded = function() {
8886
* @param {Page} page
8987
*/
9088

91-
Segment.prototype.onpage = function(page) {
89+
Attribution.prototype.onpage = function(page) {
9290
this.send('/p', page.json());
9391
};
9492

@@ -99,7 +97,7 @@ Segment.prototype.onpage = function(page) {
9997
* @param {Identify} identify
10098
*/
10199

102-
Segment.prototype.onidentify = function(identify) {
100+
Attribution.prototype.onidentify = function(identify) {
103101
this.send('/i', identify.json());
104102
};
105103

@@ -110,7 +108,7 @@ Segment.prototype.onidentify = function(identify) {
110108
* @param {Group} group
111109
*/
112110

113-
Segment.prototype.ongroup = function(group) {
111+
Attribution.prototype.ongroup = function(group) {
114112
this.send('/g', group.json());
115113
};
116114

@@ -123,7 +121,7 @@ Segment.prototype.ongroup = function(group) {
123121
* @param {Track} track
124122
*/
125123

126-
Segment.prototype.ontrack = function(track) {
124+
Attribution.prototype.ontrack = function(track) {
127125
var json = track.json();
128126
// TODO: figure out why we need traits.
129127
delete json.traits;
@@ -137,7 +135,7 @@ Segment.prototype.ontrack = function(track) {
137135
* @param {Alias} alias
138136
*/
139137

140-
Segment.prototype.onalias = function(alias) {
138+
Attribution.prototype.onalias = function(alias) {
141139
var json = alias.json();
142140
var user = this.analytics.user();
143141
json.previousId = json.previousId || json.from || user.id() || user.anonymousId();
@@ -154,7 +152,7 @@ Segment.prototype.onalias = function(alias) {
154152
* @param {Object} msg
155153
*/
156154

157-
Segment.prototype.normalize = function(msg) {
155+
Attribution.prototype.normalize = function(msg) {
158156
this.debug('normalize %o', msg);
159157
var user = this.analytics.user();
160158
var global = exports.global;
@@ -183,8 +181,8 @@ Segment.prototype.normalize = function(msg) {
183181
* @param {Function} fn
184182
*/
185183

186-
Segment.prototype.send = function(path, msg, fn) {
187-
var url = scheme() + '//api.segment.io/v1' + path;
184+
Attribution.prototype.send = function(path, msg, fn) {
185+
var url = scheme() + '//track.attributionapp.com' + path;
188186
var headers = { 'Content-Type': 'text/plain' };
189187
fn = fn || noop;
190188
var self = this;
@@ -209,8 +207,8 @@ Segment.prototype.send = function(path, msg, fn) {
209207
* @param {*} val
210208
*/
211209

212-
Segment.prototype.cookie = function(name, val) {
213-
var store = Segment.storage();
210+
Attribution.prototype.cookie = function(name, val) {
211+
var store = Attribution.storage();
214212
if (arguments.length === 1) return store(name);
215213
var global = exports.global;
216214
var href = global.location.href;
@@ -227,30 +225,6 @@ Segment.prototype.cookie = function(name, val) {
227225
store(name, val, opts);
228226
};
229227

230-
/**
231-
* Add referrerId to context.
232-
*
233-
* TODO: remove.
234-
*
235-
* @api private
236-
* @param {Object} query
237-
* @param {Object} ctx
238-
*/
239-
240-
Segment.prototype.referrerId = function(query, ctx) {
241-
var stored = this.cookie('s:context.referrer');
242-
var ad;
243-
244-
if (stored) stored = json.parse(stored);
245-
if (query) ad = ads(query);
246-
247-
ad = ad || stored;
248-
249-
if (!ad) return;
250-
ctx.referrer = extend(ctx.referrer || {}, ad);
251-
this.cookie('s:context.referrer', json.stringify(ad));
252-
};
253-
254228
/**
255229
* Get the scheme.
256230
*

package.json

+3-8
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
{
2-
"name": "analytics.js-integration-segmentio",
3-
"description": "The Segmentio analytics.js integration.",
4-
"author": "Segment <friends@segment.com>",
2+
"name": "analytics.js-integration-attribution",
3+
"description": "The Attribution analytics.js integration.",
54
"license": "MIT",
65
"main": "lib/index.js",
76
"scripts": {
@@ -12,13 +11,9 @@
1211
"npm": ">=2.7.0"
1312
},
1413
"repository": {
15-
"url": "https://github.com/segment-integrations/analytics.js-integration-segmentio.git",
14+
"url": "https://github.com/attribution/analytics.js-integration-attribution.git",
1615
"type": "git"
1716
},
18-
"bugs": {
19-
"url": "https://github.com/segment-integrations/analytics.js-integration-segmentio/issues"
20-
},
21-
"homepage": "https://segment.com/docs/integrations/segmentio/",
2217
"dependencies": {},
2318
"devDependencies": {
2419
"duo": "0.12.x",

0 commit comments

Comments
 (0)