@asayerio/analytics.js-integration-asayer
Advanced tools
Comparing version 1.0.2 to 1.1.0
@@ -0,3 +1,7 @@ | ||
1.1.0 / 2019-06-30 | ||
================== | ||
1.0.2 / 2019-26-17 | ||
* Support custom variables | ||
1.0.2 / 2019-06-27 | ||
================== | ||
@@ -4,0 +8,0 @@ |
@@ -31,22 +31,11 @@ 'use strict' | ||
if (identify.userId()) { | ||
window.asayer.vars('segment_user_id', String(identify.userId())) | ||
window.asayer.vars('userId', String(identify.userId())) | ||
} | ||
var traits = identify.traits({ | ||
'anonymousId': 'segment_anonymous_id', | ||
'email': 'segment_email', | ||
'firstName': 'segment_firstname', | ||
'lastName': 'segment_lastname', | ||
'name': 'segment_name', | ||
'title': 'segment_title', | ||
'phone': 'segment_phone', | ||
'username': 'segment_username' | ||
'anonymousId': 'anonymousId' | ||
}) | ||
for (var key in traits) { | ||
if (traits.hasOwnProperty(key)) { | ||
if (key.substring(0, 8) !== 'segment_') { | ||
delete traits[key] | ||
continue | ||
} | ||
var value = traits[key] | ||
if (typeof value !== 'string' && (typeof value !== 'number' || !isFinite(value))) { | ||
if (value !== null && typeof value !== 'boolean' && typeof value !== 'string' && (typeof value !== 'number' || !isFinite(value))) { | ||
delete traits[key] | ||
@@ -53,0 +42,0 @@ } |
{ | ||
"name": "@asayerio/analytics.js-integration-asayer", | ||
"description": "The Asayer analytics.js integration.", | ||
"version": "1.0.2", | ||
"version": "1.1.0", | ||
"keywords": [ | ||
@@ -17,3 +17,3 @@ "analytics.js", | ||
"type": "git", | ||
"url": "git+https://github.com/asayerio/analytics.js-integrations-asayer.git" | ||
"url": "git+https://github.com/asayerio/analytics.js-integration-asayer.git" | ||
}, | ||
@@ -23,5 +23,5 @@ "author": "Alex Tsokurov <alex@asayer.io>", | ||
"bugs": { | ||
"url": "https://github.com/asayerio/analytics.js-integrations-asayer/issues" | ||
"url": "https://github.com/asayerio/analytics.js-integration-asayer/issues" | ||
}, | ||
"homepage": "https://github.com/asayerio/analytics.js-integrations-asayer#readme", | ||
"homepage": "https://github.com/asayerio/analytics.js-integration-asayer#readme", | ||
"dependencies": { | ||
@@ -28,0 +28,0 @@ "@segment/analytics.js-integration": "^3.2.0", |
@@ -62,3 +62,3 @@ 'use strict' | ||
var vars = window.asayer.vars.args[0][0] | ||
analytics.assert(vars && vars.segment_anonymous_id) | ||
analytics.assert(vars && vars.anonymousId) | ||
}) | ||
@@ -68,9 +68,9 @@ | ||
analytics.identify('1') | ||
analytics.called(window.asayer.vars, 'segment_user_id', '1') | ||
analytics.called(window.asayer.vars, 'userId', '1') | ||
}) | ||
it('should send only safe traits', function () { | ||
analytics.identify('1', { 'email': 'hello@asayer.io', title: { hide: 'me' }, phone: true, unknown: 'custom' }) | ||
analytics.identify('1', { 'email': 'hello@asayer.io', title: { hide: 'me' }, phone: true, custom: 'custom' }) | ||
var vars = window.asayer.vars.args[1][0] | ||
analytics.assert(vars && vars.segment_email === 'hello@asayer.io' && !vars.segment_title && !vars.segment_phone && !vars.unknown) | ||
analytics.assert(vars && vars.email === 'hello@asayer.io' && !vars.title && vars.phone && vars.custom === 'custom') | ||
}) | ||
@@ -77,0 +77,0 @@ }) |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
0
0
0
11225
206