mixpanel-js icon indicating copy to clipboard operation
mixpanel-js copied to clipboard

ERROR TypeError: Cannot read property 'set' of undefined

Open ninahorne opened this issue 3 years ago • 1 comments

I am using this package to run mixpanel on my angular project. I am running into an issue when I try to use "mixpanel.people.set({...})". I am able to successfully use "mixpanel.identify(...)" and "mixpanel.track(...)", but this function throws the errors: ERROR TypeError: Cannot read property 'set' of undefined;

Here is my code:

package.json { "name": "client-app", "version": "0.0.0", "scripts": { "ng": "ng", "start browser": "ng serve", "start browser secure": "ng serve --ssl", "start": "node dist/server", "build": "npm run build:ssr", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e", "compile:server": "webpack --config webpack.server.config.js --progress --colors", "serve:ssr": "node dist/server", "build:ssr:staging": "npm run build:client-and-server-bundles:staging && npm run compile:server", "build:ssr:production": "npm run build:client-and-server-bundles:production && npm run compile:server", "build:ssr:productionTexas": "npm run build:client-and-server-bundles:productiontexas && npm run compile:server", "build:client-and-server-bundles": "ng build --prod --aot --output-hashing=all --build-optimizer --configuration=production && grunt purifycss && ng run ClientApp:server:production --bundleDependencies all", "build:client-and-server-bundles:production": "ng build --prod --aot --output-hashing=all --build-optimizer --configuration=production && grunt purifycss && npm run update-sitemap && ng run ClientApp:server:production --bundleDependencies all", "build:client-and-server-bundles:productiontexas": "ng build --prod --aot --output-hashing=all --build-optimizer --configuration=productiontexas && grunt purifycss && ng run ClientApp:server:productiontexas --bundleDependencies all", "build:client-and-server-bundles:staging": "ng build --prod --aot --output-hashing=all --build-optimizer --configuration=staging && grunt purifycss && ng run ClientApp:server:staging --bundleDependencies all", "prerender": "ng run wwg.web:prerender", "serve:ssrtest": "node server.js", "webpack-analyzer": "webpack-bundle-analyzer dist/browser/stats-es2015.json", "update-sitemap": "node sitemap.js" }, "private": true, "dependencies": { "@angular-devkit/build-angular": "^0.803.24", "@angular/animations": "~8.2.14", "@angular/common": "~8.2.14", "@angular/compiler": "~8.2.14", "@angular/core": "^8.2.14", "@angular/forms": "~8.2.14", "@angular/localize": "^9.1.9", "@angular/platform-browser": "~8.2.14", "@angular/platform-browser-dynamic": "~8.2.14", "@angular/platform-server": "~8.2.14", "@angular/router": "~8.2.14", "@babel/compat-data": "^7.13.8", "@ckeditor/ckeditor5-angular": "^2.0.1", "@ckeditor/ckeditor5-build-classic": "^23.1.0", "@cloudinary/angular-5.x": "^1.2.2", "@fortawesome/angular-fontawesome": "^0.6.1", "@fortawesome/fontawesome-svg-core": "^1.2.28", "@fortawesome/free-brands-svg-icons": "^5.13.0", "@fortawesome/free-solid-svg-icons": "^5.13.0", "@ng-bootstrap/ng-bootstrap": "^5.3.1", "@ng-select/ng-select": "^3.7.3", "@nguniversal/express-engine": "^8.2.6", "@nguniversal/module-map-ngfactory-loader": "v8.2.6", "@ngx-starter-kit/ngx-utils": "0.0.8", "@types/mixpanel-browser": "^2.35.6", "alertifyjs": "^1.13.1", "angularx-social-login": "2.2.1", "bootstrap": "^4.5.0", "ckeditor5-build-classic-underline-krish": "^12.3.5", "cloudinary-core": "^2.8.2", "compression": "^1.7.4", "date-fns": "^2.19.0", "domino": "^2.1.5", "express": "^4.15.2", "fs": "0.0.1-security", "google-libphonenumber": "^3.2.15", "googleapis": "^48.0.0", "j-i-c": "^2.0.2", "jquery": "^3.5.1", "libphonenumber-js": "^1.9.6", "mixpanel-browser": "^2.41.0", "moment": "^2.27.0", "ng2-file-upload": "^1.4.0", "ngx-bootstrap": "^5.6.1", "ngx-device-detector": "^1.4.5", "ngx-image-cropper": "^3.3.0", "ngx-in-viewport": "0.0.2", "ngx-loadable": "^2.1.1", "ngx-sharebuttons": "^4.1.4", "ngx-stripe": "^7.6.0", "ngx-swiper-wrapper": "^10.0.0", "ngx-useful-swiper-ssr": "^9.0.1", "node-fetch": "^2.6.1", "passport-google-oauth": "^2.0.0", "preboot": "^7.0.0", "rxjs": "^6.6.6", "rxjs-compat": "^6.6.6", "ssr-window": "^2.0.0", "swiper": "^5.4.5", "tslib": "^1.13.0", "xml-js": "^1.6.11", "zone.js": "~0.9.1" }, "devDependencies": { "@angular/cli": "^8.3.29", "@angular/compiler-cli": "~8.2.14", "@angular/language-service": "~8.2.14", "@types/express": "^4.17.11", "@types/jasmine": "~3.3.8", "@types/jasminewd2": "~2.0.3", "@types/node": "~8.9.4", "@types/swiper": "^5.4.2", "codelyzer": "^5.0.0", "glob": "^7.1.6", "grunt": "^1.3.0", "grunt-purifycss": "^0.1.2", "jasmine-core": "~3.4.0", "jasmine-spec-reporter": "~4.2.1", "karma": "^5.2.3", "karma-chrome-launcher": "~2.2.0", "karma-coverage-istanbul-reporter": "~2.0.1", "karma-jasmine": "~2.0.1", "karma-jasmine-html-reporter": "^1.4.0", "protractor": "^7.0.0", "ts-loader": "^5.2.0", "ts-node": "~7.0.0", "tslint": "~5.15.0", "typescript": "~3.5.3", "webpack-cli": "^3.3.12" }, "resolutions": { "@babel/preset-env": "7.5.5" } }

function public createUserProfile(user: User) { var mixpanel = require('mixpanel-browser'); mixpanel.people.set({ name: user.name, email: user.emailAddress, mobilePhone: user.mobilePhone, dateCreated: user.dateCreated, sourceCampaign: user.sourceCampaign }); mixpanel.identify(user.studentId) console.log("created") }

ninahorne avatar Apr 22 '21 19:04 ninahorne