Skip to content
This repository was archived by the owner on Apr 27, 2024. It is now read-only.

Commit

Permalink
Merge pull request #20 from aanchal-adk/add-getProperty-function
Browse files Browse the repository at this point in the history
Add getProperty() function to get value of super properties
  • Loading branch information
john-doherty authored Jun 28, 2021
2 parents 8d88959 + dd4140d commit cae10c8
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ mixpanel.track('Your Event Name' {
lastName: 'Optional event property 2'
});

// get super property
mixpanel.getProperty('distinct_id');

// clear current identity
mixpanel.reset();

Expand Down
4 changes: 2 additions & 2 deletions dist/mixpanel-lite.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "mixpanel-lite",
"version": "1.4.3",
"version": "1.5.3",
"description": "A lightweight alternative to mixpanel-js with offline support for Hybrid and Progressive Web Apps",
"main": "src/mixpanel-lite.js",
"scripts": {
Expand Down
11 changes: 11 additions & 0 deletions src/mixpanel-lite.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,13 @@
// holds a copy of current request properties
var _properties = {};

/**
* Returns value of the given super property
*/
function getProperty(propertyName) {
return _properties[propertyName];
}

/**
* Attempt to get the network connection type from w3c NetworkInformation or cordova-plugin-network-information
* @returns {string} connection type or empty
Expand Down Expand Up @@ -644,6 +651,9 @@
identify: function (id) {
console.log('mixpanel.identify(\'' + id + '\')');
},
getProperty: function (propertyName) {
console.log('mixpanel.getProperty(\'' + propertyName + '\')');
},
people: {
set: function (data) {
console.log('mixpanel.people.set(' + JSON.stringify(data || {}) + ')');
Expand All @@ -661,6 +671,7 @@
register: register,
reset: reset,
identify: identify,
getProperty: getProperty,
people: {
set: setPeople
},
Expand Down

0 comments on commit cae10c8

Please sign in to comment.