From 9181b2ebc4dc7dc3510b8b79282e313cd1c85801 Mon Sep 17 00:00:00 2001 From: Xinyi Ye Date: Tue, 17 Dec 2024 14:37:48 -0800 Subject: [PATCH 1/2] fix: support identify.unset --- src/amplitude-wrapper.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/amplitude-wrapper.js b/src/amplitude-wrapper.js index 4386c8f..33a884a 100644 --- a/src/amplitude-wrapper.js +++ b/src/amplitude-wrapper.js @@ -49,7 +49,8 @@ const LOG_PREFIX = '[Amplitude / GTM]'; 'setOnce', 'remove', 'preInsert', - 'postInsert' + 'postInsert', + 'unset' ]; /* To work with the identify API, pass an array of identify operations (each an array in itself) @@ -59,6 +60,8 @@ const LOG_PREFIX = '[Amplitude / GTM]'; * ['add', 'someUserProp', 1], * ['add', 'someOtherUserProp', 2], * ['prepend', 'anotherUserProp', 'someValue'] + * ['unset', 'unsetUserProp', 'value is ignored'] + * ['clearAll', 'key is ignored', 'value is ignored'] * ]); * */ @@ -80,6 +83,14 @@ const LOG_PREFIX = '[Amplitude / GTM]'; // If not a valid "identify" command, return if (identifyEnum.indexOf(cmd) === -1) return; + if (cmd === 'unset') { + identifyInstance.unset(identifyParams[0]); + } + + if (cmd === 'clearAll') { + identifyInstance.clearAll(); + } + identifyInstance[cmd].apply(identifyInstance, identifyParams); }); From 52469c5129b20831643c009bf1a436a95c013012 Mon Sep 17 00:00:00 2001 From: Xinyi Ye Date: Tue, 17 Dec 2024 14:41:01 -0800 Subject: [PATCH 2/2] update library to 2.11.10 --- src/amplitude-wrapper.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/amplitude-wrapper.js b/src/amplitude-wrapper.js index 33a884a..ccd1302 100644 --- a/src/amplitude-wrapper.js +++ b/src/amplitude-wrapper.js @@ -1,7 +1,7 @@ import { version } from '../package.json'; /* Amplitude Browser 2.0 SDK begin */ -!function(){"use strict";!function(e,t){var r=e.amplitudeGTM||{_q:[],_iq:{}};if(r.invoked)e.console&&console.error&&console.error("Amplitude snippet has been loaded.");else{var n=function(e,t){e.prototype[t]=function(){return this._q.push({name:t,args:Array.prototype.slice.call(arguments,0)}),this}},s=function(e,t,r){return function(n){e._q.push({name:t,args:Array.prototype.slice.call(r,0),resolve:n})}},o=function(e,t,r){e._q.push({name:t,args:Array.prototype.slice.call(r,0)})},i=function(e,t,r){e[t]=function(){if(r)return{promise:new Promise(s(e,t,Array.prototype.slice.call(arguments)))};o(e,t,Array.prototype.slice.call(arguments))}},a=function(e){for(var t=0;t