Skip to content

Commit

Permalink
adding check for no Mixpanel.superProperties object closes segment-in…
Browse files Browse the repository at this point in the history
  • Loading branch information
wcjohnson11 committed Sep 8, 2015
1 parent d0b360a commit 9bdcd57
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ Mixpanel.prototype.identify = function(identify) {

// explicitly set select traits as people and super properties
var opts = identify.integrations() || {};
opts = opts[this.name];
opts = opts[this.name] || {};
var superProps = pick(opts.superProperties || [], traits);
var peopleProps = pick(opts.peopleProperties || [], traits);
if (!is.empty(superProps)) window.mixpanel.register(superProps);
Expand Down
5 changes: 5 additions & 0 deletions test/index.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,11 @@ describe('Mixpanel', function() {
analytics.called(window.mixpanel.people.set, { friend: 'elmo' });
});

it('shouldn\'t try to register super properties if not specified', function() {
analytics.track('event', { friend: 'elmo' }, {});
analytics.didNotCall(window.mixpanel.register);
});

it('should convert dates to iso strings', function() {
var date = new Date();
analytics.track('event', { date: date });
Expand Down

0 comments on commit 9bdcd57

Please sign in to comment.