Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@mparticle/web-sdk

Package Overview
Dependencies
Maintainers
7
Versions
115
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mparticle/web-sdk - npm Package Compare versions

Comparing version 2.9.6-rc.1 to 2.9.7-rc.1

4

CHANGELOG.md
## Releases
--
#### 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

@@ -5,0 +9,0 @@ * Bugfix - Alias requests respect isDevelopmentMode setting

{
"name": "@mparticle/web-sdk",
"version": "2.9.6-rc.1",
"version": "2.9.7-rc.1",
"description": "mParticle core SDK for web applications",

@@ -19,2 +19,6 @@ "license": "Apache-2.0",

"test": "node test/runner.js",
"test:integration": "npm run test:requirejs",
"test:requirejs": "npm run test:requirejs:before && npm run test:requirejs:after",
"test:requirejs:before": "FILE_ORDER=before_mp karma start test/karma.requirejs.config.js",
"test:requirejs:after": "FILE_ORDER=after_mp karma start test/karma.requirejs.config.js",
"testKarma": "node test/test-karma.js",

@@ -21,0 +25,0 @@ "build": "browserify src/main.js -v -o build/mParticle-dev.js",

67

README.md

@@ -1,27 +0,37 @@

<img src="https://static.mparticle.com/sdk/mp_logo_black.svg" width="280">
<img src="https://static.mparticle.com/sdk/mp_logo_black.svg" width="280"><br>
<!-- <img src="https://img.shields.io/github/release/mparticle/mparticle-web-sdk.svg?color=green"> <img src ="https://img.shields.io/npm/v/@mparticle/web-sdk.svg?color=green"> -->
# mParticle Javascript SDK
Hello! This is the public repo of the mParticle Javascript 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 50+ services and SDKs, including developer tools, analytics, attribution, messaging, and advertising services. mParticle is designed to serve as the connector between all of these services - check out [our site](http://mparticle.com), or hit us at dev@mparticle.com to learn more.
Hello! This is the public repo of the mParticle Javascript 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 50+ services and SDKs, including developer tools, analytics, attribution, messaging, and advertising services. mParticle is designed to serve as the connector between all of these services - check out [our site](http://mparticle.com), or hit us at developers@mparticle.com to learn more.
## Documentation
Detailed documentation and other information about mParticle SDK can be found at [http://docs.mparticle.com](http://docs.mparticle.com)
Fully detailed documentation and other information about mParticle web SDK can be found at our doc site [here](https://docs.mparticle.com/developers/sdk/web/getting-started)
## Include and Initialize the SDK
There are 2 ways to initialize the SDK, either via a snippet script in your HTML file, or via npm if you plan to self host. A summary of directions for both are available below, but you should review detailed directions for the [snippet script](https://docs.mparticle.com/developers/sdk/web/getting-started) and our [self hosting](https://docs.mparticle.com/developers/sdk/web/self-hosting) options on our doc site.
### 1. Customize the SDK
### Option 1. Load mParticle via Snippet
#### 1. Customize the SDK
You can customize the SDK by setting the `mParticle.config` object prior to the SDK-download snippet.
```javascript
mParticle.config = {
isDevelopmentMode: true,
identifyRequest: {
userIdentities: { email: 'email@example.com', customerid: '123456' }
},
identityCallback: myIdentityCallback
window.mParticle = {
config: {
isDevelopmentMode: true,
identifyRequest: {
userIdentities: { email: 'email@example.com', customerid: '123456' }
},
identityCallback: myIdentityCallback
}
}
```
### 2. Include the SDK
#### 2. Include the SDK

@@ -62,6 +72,35 @@ 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.

### Option 2. Self host mParticle via npm
In your root directory:
```
npm i @mparticle/web-sdk
```
```
// index.js
import mParticle from '@mparticle/web-sdk'
let mParticleConfig = {
isDevelopmentMode: true,
identifyRequest: {
userIdentities: { email: 'h.jekyll.md@example.com', customerid: 'h.jekyll.md' }
},
identityCallback: myIdentityCallback
}
mParticle.init('REPLACE WITH API KEY', mParticleConfig);
// Now you can log an event!
mParticle.logEvent('Play Movie', mParticle.EventType.Navigation, {'movie_length':'127 minutes','rating':'PG'});
```
## Creating an Integration
Similar to other mParticle SDKs, the Javascript SDK is able to automatically include, initialize, and delegate API calls to 3rd-party Javascript SDKs. If you would like to add your company as a new Javascript integration, reference the following integrations as examples:
If you configure mParticle via a snippet tag, the Javascript SDK is able to automatically include, initialize, and delegate API calls to 3rd-party Javascript SDKs. Otherwise you will install them via npm. For more instructions on installing via npm, view the [documentation](https://docs.mparticle.com/developers/sdk/web/self-hosting).
If you would like to add your company as a new Javascript integration, reference the following integrations as examples:
- [Amplitude](https://github.com/mparticle-integrations/mparticle-javascript-integration-amplitude)

@@ -93,3 +132,3 @@ - [Appboy](https://github.com/mparticle-integrations/mparticle-javascript-integration-appboy)

The test script will run all tests using Karma and ChromeHeadless, Firefox, and Safari by default. To run tests using a different browser, use the command:
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:

@@ -99,3 +138,3 @@ ```

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

@@ -102,0 +141,0 @@ ## Development Notes

@@ -1,2 +0,2 @@

var sdkVersion = '2.9.6',
var sdkVersion = '2.9.7',
sdkVendor = 'mparticle',

@@ -3,0 +3,0 @@ platform = 'web',

@@ -1042,3 +1042,7 @@ var Helpers = require('./helpers'),

if (callback) {
Helpers.invokeCallback(callback, xhr.status, identityApiResult || null, newUser);
if (xhr.status === 0) {
Helpers.invokeCallback(callback, HTTPCodes.noHttpCoverage, identityApiResult || null, newUser);
} else {
Helpers.invokeCallback(callback, xhr.status, identityApiResult || null, newUser);
}
} else {

@@ -1045,0 +1049,0 @@ if (identityApiResult && identityApiResult.errors && identityApiResult.errors.length) {

@@ -804,2 +804,9 @@ //

currentUser = IdentityAPI.getCurrentUser();
if (Helpers.hasFeatureFlag(Constants.Features.Batching)) {
ForwardingStatsUploader.startForwardingStatsTimer();
}
Forwarders.processForwarders(config);
// Call mParticle.Store.SDKConfig.identityCallback when identify was not called due to a reload or a sessionId already existing

@@ -830,7 +837,2 @@ if (!mParticle.Store.identifyCalled && mParticle.Store.SDKConfig.identityCallback && currentUser && currentUser.getMPID()) {

if (Helpers.hasFeatureFlag(Constants.Features.Batching)) {
ForwardingStatsUploader.startForwardingStatsTimer();
}
Forwarders.processForwarders(config);
mParticle.sessionManager.initialize();

@@ -837,0 +839,0 @@ Events.logAST();

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc