Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@asayerio/analytics.js-integration-asayer

Package Overview
Dependencies
Maintainers
3
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@asayerio/analytics.js-integration-asayer - npm Package Compare versions

Comparing version 1.0.2 to 1.1.0

6

HISTORY.md

@@ -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 @@

17

lib/index.js

@@ -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 @@ })

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc