@segment/analytics.js-integration-appboy
Advanced tools
Comparing version 1.7.0 to 1.7.1
@@ -0,1 +1,6 @@ | ||
1.7.1 / 2018-08-02 | ||
================== | ||
* Revert changes introduced in 1.7.0 (#26)(#27). | ||
1.7.0 / 2018-07-31 | ||
@@ -2,0 +7,0 @@ ================== |
@@ -51,3 +51,3 @@ 'use strict'; | ||
} | ||
if (Number(options.version) === 2) { | ||
@@ -76,3 +76,3 @@ this.initializeV2(customEndpoint); | ||
/* eslint-enable */ | ||
// this is used to test this.loaded | ||
@@ -113,3 +113,3 @@ this._shim = window.appboy.initialize; | ||
}; | ||
/** | ||
@@ -124,3 +124,3 @@ * Initialize v2. | ||
var userId = this.analytics.user().id(); | ||
/* eslint-disable */ | ||
@@ -153,33 +153,12 @@ +function (a, p, P, b, y) { | ||
if (customEndpoint) config.baseUrl = customEndpoint; | ||
this.initializeTester(options.apiKey, config); | ||
window.appboy.initialize(options.apiKey, config); | ||
if (options.automaticallyDisplayMessages) window.appboy.display.automaticallyShowNewInAppMessages(); | ||
if (userId) window.appboy.changeUser(userId); | ||
window.appboy.openSession(); | ||
// Initialization of Appboy must proceed as follows: | ||
// | ||
// 1. Load Appboy's script onto the page. This is `this.load`. | ||
// 2. If there is already a cached userId for this page, then invoke | ||
// `changeUser` with that userId. Do not proceed until the in-app messages | ||
// for that user are ready. | ||
// 3. Invoke `openSession`. Do not proceed until the session is successfully | ||
// opened. | ||
// 4. Mark the integration as ready. This is `self.ready`. | ||
var self = this; | ||
if (userId) { | ||
this.load('v2', function() { | ||
window.appboy.changeUser(userId, function() { | ||
window.appboy.openSession(function() { | ||
self.ready(); | ||
}); | ||
}); | ||
}); | ||
} else { | ||
this.load('v2', function() { | ||
window.appboy.openSession(function() { | ||
self.ready(); | ||
}); | ||
}); | ||
} | ||
this.load('v2', this.ready); | ||
}; | ||
@@ -260,4 +239,6 @@ | ||
Appboy.prototype.group = function(group) { | ||
var userId = group.userId(); | ||
var groupIdKey = 'ab_segment_group_' + group.groupId(); | ||
window.appboy.changeUser(userId); | ||
window.appboy.getUser().setCustomUserAttribute(groupIdKey, true); | ||
@@ -276,2 +257,3 @@ }; | ||
Appboy.prototype.track = function(track) { | ||
var userId = track.userId(); | ||
var eventName = track.event(); | ||
@@ -286,2 +268,3 @@ var properties = track.properties(); | ||
window.appboy.changeUser(userId); | ||
window.appboy.logCustomEvent(eventName, properties); | ||
@@ -304,2 +287,3 @@ }; | ||
var userId = page.userId(); | ||
var pageEvent = page.track(page.fullName()); | ||
@@ -309,2 +293,3 @@ var eventName = pageEvent.event(); | ||
window.appboy.changeUser(userId); | ||
window.appboy.logCustomEvent(eventName, properties); | ||
@@ -326,2 +311,3 @@ }; | ||
Appboy.prototype.orderCompleted = function(track) { | ||
var userId = track.userId(); | ||
var products = track.products(); | ||
@@ -331,2 +317,4 @@ var currencyCode = track.currency(); | ||
window.appboy.changeUser(userId); | ||
// remove reduntant properties | ||
@@ -333,0 +321,0 @@ del(purchaseProperties, 'products'); |
{ | ||
"name": "@segment/analytics.js-integration-appboy", | ||
"description": "The Appboy analytics.js integration.", | ||
"version": "1.7.0", | ||
"version": "1.7.1", | ||
"keywords": [ | ||
@@ -6,0 +6,0 @@ "analytics.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
313050
9051