diff --git a/integrations/appcues/HISTORY.md b/integrations/appcues/HISTORY.md index e18ed6079..930e614f3 100644 --- a/integrations/appcues/HISTORY.md +++ b/integrations/appcues/HISTORY.md @@ -1,3 +1,8 @@ +2.3.0 / 2021-12-02 +================== + + * Appcues now accepts the group Segment call! + 2.2.0 / 2016-10-06 ================== diff --git a/integrations/appcues/lib/index.js b/integrations/appcues/lib/index.js index 8b63c98e3..8de436aee 100644 --- a/integrations/appcues/lib/index.js +++ b/integrations/appcues/lib/index.js @@ -5,7 +5,6 @@ */ var integration = require('@segment/analytics.js-integration'); -var isObject = require('isobject'); var load = require('@segment/load-script'); /** @@ -36,7 +35,7 @@ Appcues.prototype.initialize = function() { */ Appcues.prototype.loaded = function() { - return isObject(window.Appcues); + return typeof window.Appcues === 'object' && window.Appcues != null; }; /** @@ -90,6 +89,19 @@ Appcues.prototype.track = function(track) { window.Appcues.track(track.event(), track.properties()); }; +/** + * Group. + * + * http://appcues.com/docs#group + * + * @api public + * @param {Group} group + */ + +Appcues.prototype.group = function(group) { + window.Appcues.group(group.groupId(), group.traits()); +}; + /** * Expose plugin. */ diff --git a/integrations/appcues/package.json b/integrations/appcues/package.json index 74bc7ba21..34cc5a2d2 100644 --- a/integrations/appcues/package.json +++ b/integrations/appcues/package.json @@ -1,7 +1,7 @@ { "name": "@segment/analytics.js-integration-appcues", "description": "The Appcues analytics.js integration.", - "version": "2.2.1", + "version": "2.3.0", "keywords": [ "analytics.js", "analytics.js-integration", @@ -25,8 +25,7 @@ }, "dependencies": { "@segment/analytics.js-integration": "^2.1.0", - "@segment/load-script": "^1.0.1", - "isobject": "^2.1.0" + "@segment/load-script": "^1.0.1" }, "devDependencies": { "@segment/analytics.js-core": "^3.0.0", diff --git a/integrations/appcues/test/index.test.js b/integrations/appcues/test/index.test.js index f9944c13f..b798c1bf0 100644 --- a/integrations/appcues/test/index.test.js +++ b/integrations/appcues/test/index.test.js @@ -115,5 +115,19 @@ describe('Appcues', function() { }); }); }); + + describe('#group', function() { + beforeEach(function() { + analytics.stub(window.Appcues, 'group'); + }); + + it('should send an id and group name', function() { + analytics.group('id', { groupName: 'group-1' }); + analytics.called(window.Appcues.group, 'id', { + groupName: 'group-1', + id: 'id' + }); + }); + }); }); });