@snowplow/react-native-tracker
Version:
React Native tracker for Snowplow
47 lines (46 loc) • 1.37 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.newAppContextPlugin = newAppContextPlugin;
var _constants = require("../../constants.js");
/**
* Tracks the application context entity with information about the app version.
* If appBuild is provided, a mobile application context is tracked, otherwise the Web equivalent is tracked.
*
* Entity schema if `appBuild` property is set: `iglu:com.snowplowanalytics.mobile/application/jsonschema/1-0-0`
* Entity schema if `appBuild` property is not set: `iglu:com.snowplowanalytics.snowplow/application/jsonschema/1-0-0`
*/
function newAppContextPlugin(_ref) {
var appVersion = _ref.appVersion,
appBuild = _ref.appBuild;
var contexts = function contexts() {
var entities = [];
if (appVersion) {
// Add application context to all events
if (appBuild) {
entities.push({
schema: _constants.MOBILE_APPLICATION_CONTEXT_SCHEMA,
data: {
version: appVersion,
build: appBuild
}
});
} else {
entities.push({
schema: _constants.APPLICATION_CONTEXT_SCHEMA,
data: {
version: appVersion
}
});
}
}
return entities;
};
return {
plugin: {
contexts: contexts
}
};
}
//# sourceMappingURL=index.js.map