From c05b0d3dbf6c671f7bf407abecdfc160eb9cf9c2 Mon Sep 17 00:00:00 2001 From: Diel Duarte Date: Thu, 2 Dec 2021 11:27:12 -0300 Subject: [PATCH 1/5] add appcues group call support --- integrations/appcues/lib/index.js | 13 +++++++++++++ integrations/appcues/test/index.test.js | 14 ++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/integrations/appcues/lib/index.js b/integrations/appcues/lib/index.js index 8b63c98e3..27d244645 100644 --- a/integrations/appcues/lib/index.js +++ b/integrations/appcues/lib/index.js @@ -90,6 +90,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/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' + }); + }); + }); }); }); From fa0d32fc060640650abd623dbbb5f75e75bf2824 Mon Sep 17 00:00:00 2001 From: Diel Duarte Date: Thu, 2 Dec 2021 11:40:37 -0300 Subject: [PATCH 2/5] bump minor version --- integrations/appcues/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integrations/appcues/package.json b/integrations/appcues/package.json index 74bc7ba21..2687daccb 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", From ceb8dfd9c8da5abd62485c9eff61b97fb03c8f96 Mon Sep 17 00:00:00 2001 From: Diel Duarte Date: Thu, 2 Dec 2021 11:41:49 -0300 Subject: [PATCH 3/5] docs: update history.md --- integrations/appcues/HISTORY.md | 5 +++++ 1 file changed, 5 insertions(+) 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 ================== From 8b3a7db046aaf04744e8993746257144db06fce3 Mon Sep 17 00:00:00 2001 From: Diel Duarte Date: Thu, 2 Dec 2021 12:30:55 -0300 Subject: [PATCH 4/5] remove isobject dependency --- integrations/appcues/lib/index.js | 3 +-- integrations/appcues/package.json | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/integrations/appcues/lib/index.js b/integrations/appcues/lib/index.js index 27d244645..577ca6a3b 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'; }; /** diff --git a/integrations/appcues/package.json b/integrations/appcues/package.json index 2687daccb..34cc5a2d2 100644 --- a/integrations/appcues/package.json +++ b/integrations/appcues/package.json @@ -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", From 5d16a6c02cf6137fff1fdfc193df3e312d76a65e Mon Sep 17 00:00:00 2001 From: Diel Duarte Date: Mon, 6 Dec 2021 12:20:16 -0300 Subject: [PATCH 5/5] improving loaded check --- integrations/appcues/lib/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/integrations/appcues/lib/index.js b/integrations/appcues/lib/index.js index 577ca6a3b..8de436aee 100644 --- a/integrations/appcues/lib/index.js +++ b/integrations/appcues/lib/index.js @@ -35,7 +35,7 @@ Appcues.prototype.initialize = function() { */ Appcues.prototype.loaded = function() { - return typeof window.Appcues === 'object'; + return typeof window.Appcues === 'object' && window.Appcues != null; }; /**