Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@mparticle/web-sdk

mParticle82.5kApache-2.02.43.0TypeScript support: definitely-typed

mParticle core SDK for web applications

mparticle, analytics, cdp

readme


mParticle Web SDK

Hello! This is the public repo of the mParticle Web SDK. We've built the mParticle platform to take a new approach to web and mobile app data and the platform has grown to support 300+ integrations including analytics, data warehouses, and marketing automation. mParticle is designed to serve as the connector between all of these services - check out our site, or hit us at developers@mparticle.com to learn more.

Documentation

Fully detailed documentation and other information about mParticle web SDK can be found at our doc site here

Include and Initialize the SDK

There are two ways to initialize the SDK, either via a script tag, or you can bundle the SDK via NPM. A summary of steps for both are available below, but you should review the detailed documentation for the script tag and self hosting on the mParticle docs site.

Option 1. Load mParticle via Script Tag

To integrate the SDK add the following snippet to your site after customizing mParticle.config, ideally in the <head> element. Replace YOUR_API_KEY with the API key for your mParticle Web workspace.

This snippet pre-populates method stubs for much of the public SDK API, allowing immediate reference to these APIs as the SDK loads.

<script type="text/javascript">

//configure the SDK
window.mParticle = {
    config: {
        isDevelopmentMode: true,
        identifyRequest: {
            userIdentities: {
                email: 'email@example.com',
                customerid: '123456',
            },
        },
        identityCallback: function(result) {
            // Do something once an identity call has been made.
            // For more information, see https://docs.mparticle.com/developers/sdk/web/idsync/#sdk-initialization-and-identify
            console.log(result);
        },
        dataPlan: {
           planId: 'my_plan_id',
           planVersion: 2
        }
    },
};

//load the SDK
(function(e){window.mParticle=window.mParticle||{};window.mParticle.EventType={Unknown:0,Navigation:1,Location:2,Search:3,Transaction:4,UserContent:5,UserPreference:6,Social:7,Other:8,Media:9};window.mParticle.eCommerce={Cart:{}};window.mParticle.Identity={};window.mParticle.Rokt={};window.mParticle.config=window.mParticle.config||{};window.mParticle.config.rq=[];window.mParticle.config.snippetVersion=2.5;window.mParticle.ready=function(e){window.mParticle.config.rq.push(e)};var t=["endSession","logError","logBaseEvent","logEvent","logForm","logLink","logPageView","setSessionAttribute","setAppName","setAppVersion","setOptOut","setPosition","startNewSession","startTrackingLocation","stopTrackingLocation"];var i=["setCurrencyCode","logCheckout"];var n=["identify","login","logout","modify"];var o=["selectPlacements","hashAttributes","setExtensionData"];t.forEach(function(e){window.mParticle[e]=r(e)});i.forEach(function(e){window.mParticle.eCommerce[e]=r(e,"eCommerce")});n.forEach(function(e){window.mParticle.Identity[e]=r(e,"Identity")});o.forEach(function(e){window.mParticle.Rokt[e]=r(e,"Rokt")});function r(t,i){return function(){if(i){t=i+"."+t}var e=Array.prototype.slice.call(arguments);e.unshift(t);window.mParticle.config.rq.push(e)}}var c,a,s=window.mParticle.config,l=s.isDevelopmentMode?1:0,w="?env="+l,d=window.mParticle.config.dataPlan;if(d){c=d.planId;a=d.planVersion;if(c){if(a&&(a<1||a>1e3)){a=null}w+="&plan_id="+c+(a?"&plan_version="+a:"")}}var m=window.mParticle.config.versions;var f=[];if(m){Object.keys(m).forEach(function(e){f.push(e+"="+m[e])})}var p=document.createElement("script");p.type="text/javascript";p.async=true;p.src=("https:"==document.location.protocol?"https://jssdkcdns":"http://jssdkcdn")+".mparticle.com/js/v2/"+e+"/mparticle.js"+w+"&"+f.join("&");var P=document.getElementsByTagName("script")[0];P.parentNode.insertBefore(p,P)})("REPLACE WITH API KEY");
</script>

You can then log events, for example, as follows:

mParticle.logEvent('Play Movie', mParticle.EventType.Navigation, {
    movie_length: '127 minutes',
    rating: 'PG',
});

Option 2. Self host mParticle via NPM

1. Add the SDK via NPM

In your root project directory, add the SDK to your package.json:

npm install @mparticle/web-sdk

2. Customize and Initialize the SDK

// index.js
import mParticle from '@mparticle/web-sdk';

let mParticleConfig = {
    isDevelopmentMode: true,
    identifyRequest: {
        userIdentities: {
            email: 'email@example.com',
            customerid: '123456',
        },
    },
    identityCallback: myIdentityCallback,
    dataPlan: {
        planId: 'my_plan_id',
        planVersion: 2,
    },
};
mParticle.init('REPLACE WITH API KEY', mParticleConfig);

You can then log events, for example, as follows:

mParticle.logEvent('Play Movie', mParticle.EventType.Navigation, {
    movie_length: '127 minutes',
    rating: 'PG',
});

Creating an Integration

If you configure mParticle via a snippet tag, the Web SDK is able to automatically include, initialize, and delegate API calls to 3rd-party SDKs. Otherwise you will install them via npm. For more instructions on installing via npm, view the documentation.

If you would like to add your company as a new Javascript integration, reference the following integrations as examples:

Contributing

See CONTRIBUTING.md.

The test script will run all tests using Karma and ChromeHeadless, and Firefox by default. To run tests using a different browser, use the command:

$ BROWSER=[browserBrand] npm run testBrowser

where browserBrand can be another browser such as Edge or IE.

Development Notes

This package comes with the NPM package pre-commit, which will run ESLint when you try to commit.

Support

support@mparticle.com

License

The mParticle Web SDK is available under the Apache License, Version 2.0. See the LICENSE file for more info.


This project is tested with BrowserStack

changelog

2.43.0 (2025-06-10)

Features

  • Add domain to RoktManager to support CNAME for Rokt (#1039) (5ad8831)

2.42.0 (2025-06-04)

Features

  • Expose config.domain for easier CNAME configuration (#1037) (cc859d7)

2.41.1 (2025-06-03)

Bug Fixes

2.41.0 (2025-06-02)

Bug Fixes

  • Initialize Rokt before processing forwarders (#1034) (cf09cd0)

Features

2.40.0 (2025-05-27)

Features

  • Fire identify in RoktManager if user email is different from selectPlacements email (#1032) (1e3c824)

2.39.1 (2025-05-19)

Bug Fixes

  • Remove case sesitivity from query params for integration captures (#1031) (d1e86d4)

2.39.0 (2025-05-05)

Bug Fixes

  • Add Rokt hashAttributes and setExtensionData to snippet.js (#1028) (7c30759)

Features

  • Add setExtensionData method to RoktManager (#1025) (d98e83f)

2.38.1 (2025-04-28)

Bug Fixes

  • Add try/catch logic for getCookie to prevent crashes on web extensions (#1024) (4ac50cc)
  • Add try/catch to getCookies util function (#1027) (d143c39)
  • Update Placement Attributes Mapping (#1026) (9ecf540)

2.38.0 (2025-04-22)

Features

  • Add hashAttributes method to RoktManager (#1021) (4f4b168)

2.37.0 (2025-04-16)

Features

  • Add select placement attributes to current user (#1019) (1048fdf)
  • Add support for sandbox mode via selectPlacements (#1015) (d1373c6)
  • Add user attribute mapping to Rokt Manager (#1018) (99c9b54)

2.36.0 (2025-04-03)

Features

2.35.2 (2025-03-25)

Bug Fixes

2.35.1 (2025-03-20)

Bug Fixes

  • Fix context reference in PreInit.processPreloadedItem (#1005) (23a1ea5)

2.35.0 (2025-03-18)

Bug Fixes

  • Add Rokt Wrapper Methods to snippet.js (#997) (49202b3)
  • adds native collection of snap click ID (#989) (92945a9)

Features

  • Fire background AST events on page transitions if feature flag enabled (#991) (147bad2)

2.34.0 (2025-03-15)

Features

2.33.1 (2025-02-25)

Bug Fixes

2.33.0 (2025-02-13)

Features

2.32.5 (2025-02-13)

Bug Fixes

2.32.4 (2025-02-10)

Bug Fixes

  • Update new mParticleInstance instantiation (#974) (fa9e65e)

2.32.3 (2025-02-03)

2.32.2 (2025-01-27)

2.32.1 (2025-01-21)

2.32.0 (2025-01-14)

Features

  • Add support for TikTok Click and Cookie Ids (#956) (d84d759)

2.31.1 (2025-01-06)

Bug Fixes

  • Check for uploader to prevent errors when calling upload() too early (#938) (4342b0a)
  • Forward user attributes to kits properly when kit blocking is enabled and unplanned UAs are allowed (#947) (fdbc6ba)

2.31.0 (2024-12-11)

Features

2.30.4 (2024-11-05)

Bug Fixes

  • Move ready queue processing after identity request (#933) (678ccb7)

2.30.3 (2024-11-05)

2.30.2 (2024-10-28)

Bug Fixes

  • Support capturing click ids as custom flags in commerce events (#939) (6fb2476)

2.30.1 (2024-10-15)

Bug Fixes

  • Check for window.screen when setting device_info (#930) (7ce742f)

2.30.0 (2024-10-11)

Bug Fixes

  • Handle cases where window.screen is unavailable (#929) (6d042df)

Features

  • Replace XHR in IdentityApiClient with AsyncUploader (#909) (9526e3a)

2.29.0 (2024-10-08)

Bug Fixes

Features

  • Capture Integration Ids and assign to events (#926) (a916262)

2.28.3 (2024-09-16)

Bug Fixes

2.28.2 (2024-09-11)

Bug Fixes

  • Remove XHR References from Identity Utils (#905) (8beebc7)

2.28.1 (2024-09-04)

2.28.0 (2024-08-26)

Features

  • Refactor usage of XHR for Config API (#898) (0b6fae6)

2.27.0 (2024-08-13)

Bug Fixes

  • Respect directUrlRouting flag in self hosted environments (#900) (ae07504)

Features

  • Enable passing sourceMessageId to logProductAction (#901) (3b10cb1)

2.26.10 (2024-06-18)

2.26.9 (2024-06-11)

2.26.8 (2024-06-04)

2.26.7 (2024-05-29)

2.26.6 (2024-05-28)

2.26.5 (2024-05-22)

2.26.4 (2024-05-13)

2.26.3 (2024-04-29)

Reverts

  • "refactor: Refactor ParseIdentityResponse Workflow (#864)" (#879) (39163d9)

2.26.2 (2024-04-23)

2.26.1 (2024-04-22)

2.26.0 (2024-04-15)

Bug Fixes

  • Implement audience API feature flag (#865) (faa4520)
  • Migrate First and Last Seen Time Setters and Getters to Store (#856) (86a9535)
  • Update audience logic to new backend response (#844) (8a63045)
  • Update url to nativesdks and update server response (#863) (9e46cef)

Features

2.25.3 (2024-04-08)

Bug Fixes

2.25.2 (2024-04-01)

Bug Fixes

  • Combine End Session Logging Messaging flow (#848) (a2c902d)
  • Create a simple merge object utility (#849) (61e82da)

2.25.1 (2024-02-06)

Bug Fixes

  • Only cache mpid and is_loggeed_in from xhr.responseText (#838) (dd1920f)

2.25.0 (2024-01-29)

Features

2.24.0 (2024-01-09)

Features

2.23.9 (2024-01-08)

2.23.8 (2024-01-02)

Bug Fixes

  • Add filtered user identities to identity complete methods (#816) (715e217)
  • Replace identify method strings with constants (#817) (1bca974)

2.23.7 (2023-10-23)

Bug Fixes

  • Prevent immediate upload for UserAttributeChange Events (#793) (2f0c5ac)
  • Respect sideloaded kit filter dictionaries (#792) (91b6afa)

2.23.6 (2023-10-17)

Bug Fixes

2.23.5 (2023-10-09)

Bug Fixes

  • Prevent Batches from sendBeacon from being stored offline (#784) (defed0a)

2.23.4 (2023-09-25)

Bug Fixes

  • Update snippet to support snippet version pinning (#778) (1152cf5)

2.23.3 (2023-09-19)

2.23.2 (2023-07-17)

2.23.1 (2023-07-10)

Bug Fixes

  • Rename is_using_sideloaded_kits to sideloaded_kits_count (#646) (98d868c)

2.23.0 (2023-06-26)

Features

  • Support config-provided suffix in kit initialization (#617) (1052f51)

2.22.1 (2023-06-12)

Bug Fixes

  • Add Sideloaded Kit flag to Batches (#613) (13a113b)
  • Revise priority of device id when initializing state (#618) (b71f746)

2.22.0 (2023-06-05)

Bug Fixes

Features

2.21.2 (2023-05-15)

2.21.1 (2023-05-02)

Bug Fixes

2.21.0 (2023-04-18)

Features

  • Add Offline Storage for Events and Batches via Feature Flag (#402) (218bbf5)

2.20.3 (2023-04-10)

Bug Fixes

2.20.2 (2023-04-05)

Bug Fixes

2.20.1 (2023-04-05)

2.20.0 (2023-03-15)

Features

2.19.3 (2023-03-08)

Bug Fixes

  • removeUserAttribute and forwarder filters fix (#391) (838f267)
  • Verify Batches and events are uploaded in order of creation (#394) (8553331)

2.19.2 (2023-03-03)

Bug Fixes

  • Revert "refactor: Modify BatchUploader to use promises for individual uploads (#385)" (#398) (bc9de3a)

2.19.1 (2023-02-16)

2.19.0 (2023-02-08)

Features

2.18.3 (2023-02-01)

Bug Fixes

  • use currentUser consent state as backup if missing in last event (#384) (9493faa)

2.18.2 (2023-01-25)

Bug Fixes

  • Add wrapper SDK name/version setter for diagnostics (#376) (727e8e2)

2.18.1 (2023-01-04)

Bug Fixes

  • Fix Firefox Runner and Remove references to node 12 (#369) (083672f)
  • Prevent Batches from queuing empty events (#367) (4bf8ef9)

2.18.0 (2022-11-08)

Bug Fixes

  • Process queued events after there are no more integration delays (#365) (99910c7)

Features

  • Expose getEnvironment() for mParticle Instance (#366) (378b894)

2.17.4 (2022-10-11)

2.17.3 (2022-10-03)

Bug Fixes

  • Check for undefined rather than falsey values for UAC events (#361) (2514055)

2.17.2 (2022-09-14)

Bug Fixes

  • Update last event sent timestamp for batch uploads (#360) (4cbb3c5)

2.17.1 (2022-08-25)

2.17.0 (2022-08-23)

Features

2.16.3 (2022-07-28)

Bug Fixes

  • prevent errors when onCreateBatch does not return a batch (#299) (c8f085d)

2.16.2 (2022-06-29)

2.16.1 (2022-06-16)

Bug Fixes

2.16.0 (2022-05-18)

Features

2.15.5 (2022-05-11)

Bug Fixes

  • add warning of upcoming upgrade for V2 Users (#237) (93d1ad4)

2.15.4 (2022-05-02)

Bug Fixes

  • add UAC and UIC as upload triggers (7576509)

2.15.3 (2022-04-28)

Bug Fixes

2.15.2 (2022-04-27)

2.15.1 (2022-04-20)

Bug Fixes

  • add validation to prevent null event category from sending (#358) (cc93497)
  • decode cookie error on special character attributes (#365) (9237a44)
  • ensure sessions/AST initialize before identity callback (#360) (2663a57)

2.15.0 (2022-03-01)

Bug Fixes

  • prevent erroneous event logging to kits when an event is not sent (dfc0f4f)

Features

  • add API to set device id (#341) (b81e4d3)
  • add isInitialized to mParticle object (5fbc9df)

2.14.2 (2022-02-09)

Bug Fixes

  • Refactor Public methods to queue if Store is not initialized (#311) (27d506c)
  • Update cookie sync date only upon successful cookie sync (48d6fe1)
  • update reusable workflow urls (#265) (1c334d3)

2.14.1 (2021-09-02)

Bug Fixes

  • Add launch_referrer to event data (cd7dc62)
  • Allow multiple promotions to be logged when calling logPromotion (9e0dd5b)

2.14.0 (2021-08-04)

Bug Fixes

  • globalThis is not defined (3a849c6)
  • Update semantic release secret name (0824ef5)

Features

  • Allow scope param on user alias requests (a864aef)

2.13.0 (2021-07-29)

Features

  • Bypass functionality when a specific config option is passed (#159) (2727a43)

2.12.9 (2021-06-23)

Bug Fixes

  • Update esm/common rollup.config to prevent regenerator runtime issue (2ff362f)

Releases

--

2020-05-06

  • Any new workspaces with JS API Keys will now batch all web events in order to save bandwidth and improve site performance. To read more about web batching see here - https://docs.mparticle.com/developers/sdk/web/getting-started#upload-interval--batching. This does not require any updates to the SDK itself. No implementation changes are required. If you have a workspace created prior to 2020-05-06 and are not yet on batching, please contact your Customer Success Manager.

2.12.8 - 2021-04-06

  • Bugfix: Rename pageViewFilters to screenAttributeFilters Enables screen attributes to be filtered out on downstream forwarders

2.12.7 - 2021-03-25

  • Bugfix - Add product impressions to kit blocking
  • Feat - Consent-based cookie-sync
  • Bugfix - Add source message id

2.12.5 - 2021-02-17

  • Bugfix - Use addEventListeners for life cycle events
  • Bugfix - Set setCurrencyCode on eCommerce object

2.12.4 - 2021-02-09

  • Refactor - Import version from package.json
  • Format code styling

2.12.3 - 2021-01-20

  • Bugfix - update is first run to booleans
  • Bugfix - Sanitize ecommerce amounts to numbers
  • Bugfix - Set sessionStartDate to 0 instead of null
  • Bugfix - Error events - Set to null if stack trace is undefined; Add context to error events

2.12.2 - 2020-11-12

  • Bugfix - Fix data plan options API
  • Bugfix - Add try/catch to cookie searching

2.12.1 - 2020-11-11

  • Fix Typo in logging
  • Update identity mappings
  • Bugfix - Add check for window for node environments

2.12.0 - 2020-10-29

  • Feat - Implement client side kit blocking You can now use Data Master to block unplanned events and attributes from being sent to client side forwarders.

2.11.16 - 2020-10-26

  • Remove eventsApiModels.ts in favor of js-events npm module
  • Feat - Add event and product context to sanitized attributes
  • Add logic to handle Media Events as Custom Events
  • Add additional tests for app name change in config

2.11.15 - 2020-06-30

  • Feat - Add transactionAttributes to logProductAction method signature

2.11.14 - 2020-06-24

  • Bugfix - Make tagging batches with appropriate UI more robust

2.11.13 - 2020-06-17

  • Bugfix - prevent null CCPA consent on events v3 endpoint

2.11.12 - 2020-06-03

  • Bugfix - logProductActions of purchase/refund conform to logPurchase/logRefund

2.11.11 - 2020-05-12

  • Feat - Add Other5-Other10, mobile/phone number identity types

2.11.10 - 2020-04-23

  • Bugfix - Fix v3 events endpoint location payload

2.11.9 - 2020-04-02

  • Bugfix - Send specific user along with UIC and UAC Events
  • Dependabot - Bump Acorn version

2.11.8 - 2020-03-16

  • Don't set empty TransactionAttribute fields

2.11.7 - 2020-03-04

  • Deprecate removeCCPAState in favor of removeCCPAConsentState
  • Feat - XHR Support for Batching

2.11.6 - 2020-02-26

  • Migrate network tests from local Mockhttprequest to Sinon
  • Bugfix - Flush eventQueue after identity callback

2.11.5 - 2020-02-12

  • Update node version for Travis
  • Api docs update
  • Bugfix - Enable configuration of v1 endpoints

2.11.4 - 2020-02-06

  • Feat - Modify reset API for public consumption
  • Feat - Import @mparticle/event-models to replace eventApiModels
  • Bugfix - Typo & keep persistence checking consistent

2.11.3 - 2020-02-04

  • Update package.json (Add mparticle.js to dist/ for partner kit testing)

2.11.2 - 2020-02-01

  • Feat - Add support for custom v3 URL

2.11.1 - 2020-01-29

  • Bugfix - resolve when browser has disabled localStorage
  • Bugfix - Do not log deprecated warnings when logging purchases
  • Feat - Add support for Data Planning to V2 Events upload

2.11.0 - 2020-01-16

  • Feat - Add CCPA support
  • Add batch creator class for ESLint data planning plugin

2.10.2 - 2019-12-19

  • Feat - Pass appName to config

2.10.1 - 2019-12-11

  • Bugfix - Do not populate data plan context when plan id is null

2.10.0 - 2019-11-13

  • Feat - Implement Multiple Instances

2.9.16 - 2019-11-06

  • Bugfix - Parse string in shouldEnableBatching

2.9.15 - 2019-11-06

  • Deprecate Cart - The mParticle functionality will be removed in a future release, please
  • Bugfix - Self hosting namespaces storage with workspaceToken again

2.9.14 - 2019-10-31

  • Remove mparticle.js from root
  • Feat - Stub logBaseEvent in snippet, add snippet comments
  • Feat - Implement User Identity Change & User Attribute Change Events
  • Allow MediaEvents and Media PageEvents to be supported
  • Happy Halloween! :jack_o_lantern:

2.9.13 - 2019-10-09

  • Refactor codebase with Prettier
  • Bugfix - Resolve Sonarqube code smells
  • Modify Rollup builds

2.9.12 - 2019-10-02

  • Support event batching and beacon API; provide new Events API v3 endpoint which supports batching
  • Implement Typescript and Babel compilation
  • Feat - Enable configuration of config endpoint

2.9.11 - 2019-09-26

  • Feat - Add Base Event functionality to core for future child SDK use
  • Update .eslintrc, fix urls in yuidoc comments

2.9.10 - 2019-08-21

  • Add integration tests for bundlers (webpack, browserify, rollup)
  • Bugfix - Make getCartProducts more robust
  • Bugfix - Fix immediate logging for self hosting
  • Feat - add session start to server DTO
  • Bugfix - update modify old_value

2.9.9 - 2019-08-07

  • Bugfix - Check all event attributes when forwarding rules are set

2.9.8 - 2019-08-07

  • Migrate to ES6 Modules; Replace Browserify with Rollup

2.9.7 - 2019-07-16

  • Bugfix - noHttpCoverage code properly sent to callback
  • Bugfix - Configure forwarders prior to identify callback

2.9.6 - 2019-07-08

  • Bugfix - Alias requests respect isDevelopmentMode setting

2.9.5 - 2019-07-01

  • Bugfix - set isInitialized in both web and webview contexts
  • Feature: log error custom attributes
  • Update build parameters

2.9.4 - 2019-06-25

  • Modify files for self hosting
    • Add a /config endpoint
    • Accept 2nd argument to init for configuration
  • Bugfix - Initialize Logger before Store

2.9.3 - 2019-06-20

  • Bugfix - retain mParticle.isIOS on script load

2.9.2 - 2019-06-10

  • Bugfix - respect mParticle.isIOS setting

2.9.1 - 2019-06-05

  • Make endpoints configurable

2.9.0 - 2019-05-28

  • Implement User Aliasing
  • Bugfixes - Helpers.debug & set isFirstRun to false after app inits for the first time

2.8.12 - 2019-05-08

  • Implement firstSeen and lastSeen fields for MParticleUser
  • Sort MParticleUser Array returned by getUsers() by lastSeenTime
  • Bugfix - Callback validation & correct warning message
  • Add getPreviousUser() to Identity callbacks

2.8.11 - 2019-04-24

  • Refactor config into a class
  • Implement Logger
  • Fix consent object validation and remove unneeded null check

2.8.10 - 2019-04-10

  • Prefer modules over public mParticle methods

2.8.9 - 2019-03-13

  • Simplify / remove migrations

2.8.8 - 2019-02-20

  • Bugfix - Native SDK - prioritize equality of requiredWebviewBridgeName

2.8.7 - 2019-02-14

  • Update native bridge logic

2.8.6 - 2019-02-14

  • Namespace localstorage with workspace token

2.8.5 - 2019-02-13

  • Add callback to location tracking method

2.8.4 - 2019-02-04

  • Set session attributes when using native bridge

2.8.3 - 2019-01-30

  • Bugfix - Check for LocalStorage before migrating

2.8.2 - 2019-01-25

  • Bugfix - Guard against undefined result from crypto API
  • Bugfix - Call identify if cookies exist, but there is no current user

2.8.1 - 2019-01-23

  • Add identityMethod to onUserIdentified function definition
  • Bugfix - return 0 instead of null for hashing boolean false

2.8.0 - 2018-12-19

  • Fix autogen yuidocs comments
  • Add get/setIntegrationAttribute APIs
  • Add snippet tests
  • Add boolean validation for isDevelopmentMode

2.7.8 - 2018-10-24

  • Initialize forwarders based on logged in status

2.7.7 - 2018-10-15

  • Bugfix - remove cart item uses proper product persistence
  • Bugfix - Guard against corrupt local storage/cookies

2.7.6 - 2018-10-10

  • Bugfix - guard against null cookie

2.7.5 - 2018-09-19

  • Add getUser method to identity callback results
  • Only call initial identify and callback once
  • Bugfix - logLevel

2.7.4 - 2018-09-14

  • Bugfix - Remove corrupt localStorage
  • Bugfix - Fix encoding LS for special characters

2.7.3 - 2018-08-30

  • Bugfix - Always init forwarder when no UA filters are present

2.7.2 - 2018-08-22

  • Re-initialize forwarders after userAttr changes
  • Capitalize all letters in sessionId

2.7.1 - 2018-08-10

  • Bugfix - Create copy of MP.eventQueue to iterate through

2.7.0 - 2018-08-08

  • Add setUserAttributes to public API

2.6.4 - 2018-08-01

  • Implement forwarderUploader module, feaure flags, batch forwarder stats
  • Bugfix - Change ProductActionTypes to be consistent with mobile/S2S

2.6.3 - 2018-07-18

  • Implement customFlags per public API method

2.6.2 - 2018-07-16

  • Update growl and hoek for testing dependencies
  • Bugfix - sendEventToForwarder fix

2.6.1 - 2018-07-11

  • Default forceHttps to true
  • Add apiClient module

2.6.0 - 2018-06-20

  • Implement Consent forwarding rules

2.5.1 - 2018-06-11

  • Bugfix - Fix filterUserAttributeValues break/continue

2.5.0 - 2018-06-06

  • Expose getUser and getUsers to public Identity API
  • Bugfix - send newUser to forwarder on user identified
  • Add filtered user object

2.4.1 - 2018-05-09

  • Bugfix - encode event value before sending to iOS
  • Update package-lock.json to pass CI tests

2.4.0 - 2018-04-26

  • Implement Consent State
  • Expose Identitiy HTTP constants to the public

2.3.3 - 2018-04-19

  • Bugfix - filter user attributes to forwarders on init

2.3.2 - 2018-04-04

  • Bugfix - filter user attributes to forwarders on init

2.3.1 - 2018-04-02

  • Bugfix - Compare strings when filtering event/user attribute values

2.3.0 - 2018-03-28

  • Bugfix - Prioritize client entered config over persistence
  • Bugfix - Correct capitalization of clearing eCommerce carts
  • Add Identify to public API

2.2.6 - 2018-03-07

  • Add forceHttps as a config option
  • Fix linting
  • Migrate all mpids between cookies and LS when useCookieStorage changes

2.2.5 - 2018-03-01

  • Bugfix - add shouldUseNativeSdk logic to fix null user and null path values

2.2.4 - 2018-02-28

  • Add config option for maxCookieSize
  • Refactor useNativeSdk and prevent identify calls when in webview

2.2.3 - 2018-02-23

  • Update logic for useNativeSdk and isIOS

2.2.2 - 2018-02-20

  • Pass identityApiData to native SDKs

2.2.1 - 2018-02-14

  • Queue events when mpid is null or 0
  • Stub primary methods for pre-loading SDK invocation
  • Add eventSubscriptionId to forwarder contract
  • Update readme to remove adchemix

2.2.0 - 2018-01-31

  • Remove product bags

2.1.5 - 2018-01-25

  • Update version endpoint for /Forwarding

2.1.4 - 2018-01-10

  • Ensure customerid is always the first identity being set
  • Auto generate API docs
  • Add migration for base64 encoded products
  • Finalize Other IDs
  • Bugfix - Adjust logic for session end event

2.1.3 - 2017-12-20

  • Remove logLTVIncrease
  • Return an empty array when there are no cart products
  • Bugfix - Adjust arguments for applyToForwarders

2.1.2 - 2017-12-14

  • Add setForwarderOnUserIdentified, return null currentUser when MPID is null

2.1.1 - 2017-12-13

  • Modularize tests for readability and robustness
  • Adjust Application State Transition, include initial location
  • Bugfix - Add CheckoutOption to ProductAction-related switch statements
  • Add parseStringOrNumber function
  • Sanitize additional attributes
  • Correct order of internal createProducts arguments
  • Refactor logPageView
  • Require explicit UIWebview binding

2.1.0 - 2017-11-30

  • Migrate persistence to v4
  • Add onUserAlias callback

2.0.13 - 2017-11-08

  • Add support for filtering user attribute values
  • Update persistence after a modify call

2.0.12 - 2017-10-23

  • Complete modularization of SDK

2.0.11 - 2017-10-19

  • Modularize Types, Constants, Helpers, DTO, Identity, Ecommerce
  • Reorganize tests

2.0.10 - 2017-10-17

  • Bugfix - Execute useLocalStorage method

1.14.1 - 2017-06-22

  • Fixes for cookie syncing. Properly cookie sync when MPID changes, and only perform a cookie sync when debug modes for defined pixel and mParticle match
  • Store productBags and cartProducts to cookies, with config option to change number of products allowed in each (config.maxProducts = 20 by default)
  • Prevent setUserIdentity from accepting booleans
  • Clean up code - Add additional validations, convert remaining == to ===

1.14.0 - 2017-06-15

  • Support for cookie-syncing. Cookie-syncing enables the optional collection of 3rd-party IDs to enable enhanced audience sharing with advertising platforms such as DoubleClick, Adobe, and AppNexus
  • Add application state transition to mParticle initialization

1.13.1 - 2017-05-25

  • Fix for removing duplicate user identities where ID is missing, allow ID to be undefined
  • Fix for creating CGID on initial load

1.13.0 - 2017-05-18

  • Send sessionLength to server when sessionEnd is called.

1.12.0 - 2017-05-11

  • Add deviceId, and deviceId retrieval via mParticle.getDeviceId().

1.11.0 - 2017-04-27

  • Add new session management.
  • Fixed a bug where the same sessionId may be associated with events over several days.

1.10.0 - 2017-04-20

  • Added config option for useCookieStorage to allow use of either cookies or localStorage. By default, localStorage is used (useCookieStorage = false). If localStorage not available, reverts to cookie use.
  • Fixed a bug where forwarders contained a mix of both initialized and uninitialized forwarders. forwarders now only contains initialized forwarders.

1.9.0 - 2017-04-17

  • Fixed bug where calling setUserIdentity with a similar type added another identity, rather than replacing the identity.
  • Calling setUserIdentity with id = null and valid type will remove the user identity of that type.
  • Include CommerceEvent custom attributions in expansion; makes a copy of the original commerce event rather than referencing it, which would mutate it.