From fade3e9ba9d737926b9f1fb0e293ef8130ee4b7b Mon Sep 17 00:00:00 2001 From: ShiCheng Lu Date: Tue, 1 Oct 2024 17:07:46 -0400 Subject: [PATCH 1/2] add mParticle web sdk setup guide --- docs/integrations/mparticle.mdx | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/docs/integrations/mparticle.mdx b/docs/integrations/mparticle.mdx index 472f94aed..79f8dbb99 100644 --- a/docs/integrations/mparticle.mdx +++ b/docs/integrations/mparticle.mdx @@ -50,7 +50,8 @@ If not leveraging a customer ID in mParticle but there is a need to set the Rada defaultValue="swift" values={[ { label: 'Swift', value: 'swift' }, - { label: 'Kotlin', value: 'kotlin' } + { label: 'Kotlin', value: 'kotlin' }, + { label: 'Web', value: 'web' } ]} > @@ -90,6 +91,30 @@ MParticle.getInstance()?.Identity()?.addIdentityStateListener { user, _ -> ``` + + +Follow instructions from mParticle for web initialization, then add the mParticle ID to Radar metadata on initialization. + +```js + window.mParticle = { + config: { + ... + identityCallback: function(result) { + if (result.getUser()) { + Radar.setMetadata({"mParticleId": result.getUser().getMPID()}) + } else { + // the IDSync call failed + } + } + } + }; + //load the SDK + ( + function(e){window.mParticle=...} + )("REPLACE WITH API KEY"); +``` + + ### Kit From 8ab107b1004e824d2376ec40b095212d6ddaee45 Mon Sep 17 00:00:00 2001 From: ShiCheng Lu Date: Thu, 24 Oct 2024 15:37:37 -0400 Subject: [PATCH 2/2] Update mparticle.mdx --- docs/integrations/mparticle.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/integrations/mparticle.mdx b/docs/integrations/mparticle.mdx index 79f8dbb99..6ac5e678c 100644 --- a/docs/integrations/mparticle.mdx +++ b/docs/integrations/mparticle.mdx @@ -108,10 +108,10 @@ Follow instructions from mParticle for web initialization, then add the mParticl } } }; - //load the SDK + ( function(e){window.mParticle=...} - )("REPLACE WITH API KEY"); + )("REPLACE WITH MPARTICLE API KEY"); ```