Skip to content

Commit e974e93

Browse files
fix: add package and app info to mParticle MPConfiguration (#109)
1 parent 104b297 commit e974e93

5 files changed

Lines changed: 7832 additions & 6446 deletions

File tree

core-sdk-samples/higgs-shop-sample-app/package-lock.json

Lines changed: 17 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core-sdk-samples/higgs-shop-sample-app/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"@emotion/react": "^11.7.1",
66
"@emotion/styled": "^11.6.0",
77
"@fontsource/lato": "^4.5.5",
8-
"@mparticle/web-sdk": "^2.15.0",
8+
"@mparticle/web-sdk": "^2.16.0",
99
"@mui/icons-material": "^5.5.1",
1010
"@mui/material": "^5.2.5",
1111
"@testing-library/dom": "^8.11.3",
@@ -44,7 +44,7 @@
4444
]
4545
},
4646
"devDependencies": {
47-
"@types/mparticle__web-sdk": "^2.15.1",
47+
"@types/mparticle__web-sdk": "^2.16.0",
4848
"@typescript-eslint/eslint-plugin": "^5.17.0",
4949
"@typescript-eslint/parser": "^5.19.0",
5050
"eslint": "^7.32.0",

core-sdk-samples/higgs-shop-sample-app/src/layouts/App/index.test.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,16 @@ import { render, waitFor } from '@testing-library/react';
22
import mParticle from '@mparticle/web-sdk';
33
import App from '.';
44

5+
const { version } = require('../../../package.json');
6+
57
describe('mParticle Web Sample App', () => {
68
test('should initialize the Web SDK', async () => {
79
render(<App />);
810
await waitFor(() => {
911
expect(mParticle.init).toHaveBeenCalledWith('test_key', {
12+
appName: 'Higgs Shop',
13+
appVersion: version,
14+
package: 'com.mparticle.example.HiggsShopSampleApp',
1015
isDevelopmentMode: true,
1116
logLevel: 'verbose',
1217
identityCallback: expect.any(Function),

core-sdk-samples/higgs-shop-sample-app/src/layouts/App/index.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,27 @@ import { AccountPage } from '../../pages/AccountPage';
1818
import { MessageModal } from '../../components/MessageModal';
1919
import { APIkeyModalMessage } from '../../constants';
2020

21+
// (optional) Use the package version number to keep your appVersion up-to-date
22+
const { version } = require('../../../package.json');
23+
2124
const App = () => {
2225
const [apiKeyModalOpen, setApiKeyModalOpen] = useState(false);
2326

2427
const mParticleConfig: mParticle.MPConfiguration = {
28+
// (optional) `appName and appVersion are used to associate with your web app
29+
// and are included in all event uploads
30+
appName: 'Higgs Shop',
31+
appVersion: version,
32+
33+
// `package` is an optional analytics attribute that mParticle
34+
// uses to measure usage and diagnostics of the Sample Apps.
35+
// In a production application, you can safely remove this, or set
36+
// it to your own value to help with diagnostics.
37+
package: 'com.mparticle.example.HiggsShopSampleApp',
38+
39+
// Sets to Dev Mode
2540
isDevelopmentMode: true,
41+
2642
// logLevel can be 'verbose', 'warning', or 'none' (the default is 'warning').
2743
// This logLevel provides context into the inner workings of mParticle.
2844
// It can be updated after MP has been initialized using mParticle.setLogLevel().

0 commit comments

Comments
 (0)