Releases: vingkan/prometheus
Denormalized Visits in Firebase
Prometheus.js is an open source CRM library built on top of Firebase and ReactFire. Prometheus brings the fire of specific user tracking to humanity so that you can gather crucial information about your users' experience and follow up. Available on npm.
To improve the speed of retrieving data, the visits saved by Prometheus will now be located at prometheus/visits/{uid}
in your Firebase instead of at prometheus/{uid}/visits
. When you update Prometheus, the visits will be saved at the new location. To move the rest of your visits data to this format, you can use these two scripts (with your own Firebase configs):
Copy Visits to New Location
var targetConfig = {
apiKey: "%API_KEY%",
authDomain: "%AUTH_DOMAIN%",
databaseURL: "%DATABASE_URL%"
};
var targetFirebase = firebase.initializeApp(targetConfig, 'Target Firebase');
var db = targetFirebase.database();
db.ref('prometheus/users').once('value', function(usersSnap){
usersSnap.forEach(function(userDataSnap){
var uid = userDataSnap.key;
var userData = userDataSnap.val();
var visits = userData.visits;
for(var v in visits){
if(visits[v]){
console.log('Moved visit to: prometheus/visits/' + uid);
db.ref('prometheus/visits/' + uid).push(visits[v]);
}
}
});
});
Delete Visits from Old Location
var targetConfig = {
apiKey: "%API_KEY%",
authDomain: "%AUTH_DOMAIN%",
databaseURL: "%DATABASE_URL%"
};
var targetFirebase = firebase.initializeApp(targetConfig, 'Target Firebase');
var db = targetFirebase.database();
db.ref('prometheus/users').once('value', function(usersSnap){
var allUsers = usersSnap.val();
for(var u in allUsers){
if(allUsers[u]){
console.log('Removed visits at: prometheus/users/' + u + '/visits');
db.ref('prometheus/users/' + u + '/visits').remove();
}
}
});
Last Visit Timestamps
Additionally, Prometheus will now update the timestamp of a users' latest activity whenever a visit is saved. These timestamps will be located at prometheus/users/{uid}/lastVisit
and can be used for sorting or prioritizing users when retrieving profiles or doing analysis over your Prometheus data. You can update the lastVisit
timestamps for all users in your Firebase with this script:
var targetConfig = {
apiKey: "%API_KEY%",
authDomain: "%AUTH_DOMAIN%",
databaseURL: "%DATABASE_URL%"
};
var targetFirebase = firebase.initializeApp(targetConfig, 'Target Firebase');
var db = targetFirebase.database();
db.ref('prometheus/users').once('value', function(usersSnap){
var allUsers = usersSnap.val();
for(var u in allUsers){
if(allUsers[u]){
var visitsRef = db.ref('prometheus/visits/' + u);
visitsRef.once('value', function(visitsSnap){
var visits = visitsSnap.val();
var uid = visitsSnap.key;
var latest = 0;
for(var v in visits){
if(visits[v]){
var time = visits[v].meta.datetime.timestamp;
if(time > latest){
latest = time;
}
}
}
console.log('Updated last visit timestamp: prometheus/users/' + uid + '/lastVisit');
db.ref('prometheus/users/' + uid + '/lastVisit').set(latest);
});
}
}
});
Dashboard Updates
The pandora-simple
folder contains the updated dashboard view for this new format. Simply edit your config in the scripts/config.js
file.
About Us
Prometheus.js and PandorasBox.js were created by the development team at Omnipointment: the omnipotent appointment scheduling tool.
Detailed Documentation
Prometheus.js is an open source CRM library built on top of Firebase and ReactFire. Prometheus brings the fire of specific user tracking to humanity so that you can gather crucial information about your users' experience and follow up. Available on npm.
The new version includes minor upgrades to the redeem()
method and a path for the Note.terminate()
method. The API documentation for the library is now also much more comprehensive.
About Us
Prometheus.js and PandorasBox.js were created by the development team at Omnipointment: the omnipotent appointment scheduling tool.
Remote Config
Prometheus.js is an open source CRM library built on top of Firebase and ReactFire. Prometheus brings the fire of specific user tracking to humanity so that you can gather crucial information about your users' experience and follow up. Available on npm.
The new upgrades to Prometheus include feature delivery definitions that allow you to separate business logic from app logic. Webmasters can now also offer promo codes that let your users obtain access to features without waiting for you!
Prometheus: Remote Configuration
This is a pre-release. The analytics dashboard is not yet configured to allow manipulation of features and promo codes. Those edits must be made manually in Firebase.
Usage
Prometheus' deliver()
method has been rebuilt to allow for more complex feature validation. This pre-release does not include dashboard updates that allow for manipulation of features, but it does bring a new redeem()
function that allows users to receive access to features the webmaster has defined in the project Firebase. See payment.html
for a demo of the new deliver method with returned user data.
prometheus.deliver(featureID, callback, fallback)
Checks if a user has access to the given feature and runs the appropriate asychronous function.
- featureID (string, required): ID of feature to look up.
- callback (function, required): function to run if user does have access to feature. Receives any data passed back from the validation as an argument.
- fallback (function, recommended): function to run if user does not have access to feature. Receives any data passed back from the validation as an argument.
Validate Function
Each feature entry must have a validate
function that checks if the user can access the given feature, based on their data properties. The function definition can also choose what user data, if any, to pass back to the client.
Sample validate
function for a create meeting feature delivery request, store this in Firebase with feature data:
// TO-DO: Check if user has `createCredits` data property
if (userData.createCredits > 0) {
userData.createCredits--;
return {
allowed: true,
changed: true,
data: {
createCredits: userData.createCredits
}
};
} else {
return {
allowed: false,
data: {
createCredits: userData.createCredits
}
};
}
Where to store in Firebase:
prometheus.redeem(code, callback, fallback)
Looks up a given promo code and runs the promo code's redeem function on the user's feature data.
- code (string, required): promo code stored at
prometheus/promos/{code}
. Must have a redeem function. - callback (function, recommended): function to run if code is redeemed. Callback receives the information stored with the code in Firebase as its only argument, if any.
- fallback (function, recommended): function to run if code is not found or is unredeemable. Fallback receives error type and error message.
Redeem Function
Each promo code entry must have a redeem
function that updates the users' data according to the promotion.
Sample redeem
function for a create meeting credit promo code, store this in Firebase with promo data:
userData.createCredits += 5;
return userData;
Where to store in Firebase:
Migrating Features Data
Run this script in the console of your app to migrate existing features data from the prometheus/features
branch to each user's data
branch. The script will generate validation functions for those features but leave behind the list of allowed user IDs to allow the Dashboard to continue displaying access.
var db = firebase.database().ref('prometheus/features');
db.once('value', function(snapshot){
var val = snapshot.val()
for(var feature in val){
if(val[feature]){
var users = val[feature].access;
for(var i in users){
console.log(feature, users[i]);
var uid = users[i];
var path = 'prometheus/users/' + uid + '/data/' + feature;
var ref = firebase.database().ref(path);
ref.set(true);
}
var validatePath = 'prometheus/features/' + feature + '/validate/';
var featureRef = firebase.database().ref(validatePath);
var validateFn = "if(userData.hasOwnProperty('" + feature + "')){if(userData['" + feature + "']){return {allowed: true, changed: false}}else{return {allowed: false}}}else{return {allowed: false}}";
featureRef.set(validateFn);
}
}
});
About Us
Prometheus.js and PandorasBox.js were created by the development team at Omnipointment: the omnipotent appointment scheduling tool.
Timers with Data
Prometheus.js is an open source CRM library built on top of Firebase and ReactFire. Prometheus brings the fire of specific user tracking to humanity so that you can gather crucial information about your users' experience and follow up. Available on npm.
The new upgrades to Prometheus include Timers that allow developers to track how long it takes for users to complete specific actions on their site. Timers can now store additional data, other than time, about the action being tracked.
Prometheus: Timers
Track how long users take to complete specific actions on your site.
Demo
The Prometheus team wanted to know how long users spend writing their contact messages as well as if there was any wait time between arriving on the page and starting to write. Multiple timers allow tracking of both. This is the kind of information the dashboard displays:
Usage
Calling prometheus.timer(timerID)
returns the Timer
object that corresponds to that id/activity.
prometheus.timer(timerID)
Track the duration of specific activities.
- timerID (string, required): id used to time a specific activity
- Returns: Timer
- start (function, data): starts timing the activity
- data (obj, optional): additional data about the event
- stop (function, data): finishes timing and saves event
- data (obj, optional): additional data about the event
- Note: data passed to
.stop()
will override data passed to.start()
if they have the same key
- start (function, data): starts timing the activity
Example from Demo:
This block of code is responsible for recording timers shown in the demo.
prometheus.timer('contact_form_total').start();
var emailInput = document.getElementById('email');
emailInput.addEventListener('focus', function(){
// You can run multiple timers on the same page
prometheus.timer('contact_form_writing').start({trigger: 'email input'});
// Timer.start() can be called with additional data about the event
});
var messageInput = document.getElementById('message');
messageInput.addEventListener('focus', function(){
// You can have multiple start points for the same timer, any repeated start() calls will not override the original start time
prometheus.timer('contact_form_writing').start({trigger: 'message input'});
});
function submitMessage(email, message){
// ... Message is submitted here
prometheus.timer('contact_form_total').stop();
// Timer.stop() can be called with additional data about the event
prometheus.timer('contact_form_writing').stop({length: message.
// Currently, each timer should only be stopped in one place, but stopping multiple different timers together is fine
}
$('#contact-button').click(function(){
// ... Message is handled here
submitMessage(email, message);
});
Other Upgrades
- Bug Fix on v1.3.3: When tracking is turned off on localhost, login profiles will now no longer update on localhost either.
- Prometheus user tracking IDs will now be stored in
localStorage
instead ofsessionStorage
for persistence.
If you have any questions about these upgrades, please reach out to us.
About Us
Prometheus.js and PandorasBox.js were created by the development team at Omnipointment: the omnipotent appointment scheduling tool.
Timers
Prometheus.js is an open source CRM library built on top of Firebase and ReactFire. Prometheus brings the fire of specific user tracking to humanity so that you can gather crucial information about your users' experience and follow up. Available on npm.
The new upgrades to Prometheus include Timers, that allow developers to track how long it takes for users to complete specific actions on their site.
Prometheus: Timers
Track how long users take to complete specific actions on your site.
Demo
The Prometheus team wanted to know how long users spend writing their contact messages as well as if there was any wait time between arriving on the page and starting to write. Multiple timers allow tracking of both. This is the kind of information the dashboard displays:
Usage
Calling prometheus.timer(timerID)
returns the Timer
object that corresponds to that id/activity.
prometheus.timer(timerID)
Track the duration of specific activities.
- timerID (string, required): id used to time a specific activity
- Returns: Timer
- start (function, void): starts timing the activity
- stop (function, void): finishes timing and saves event
Example from Demo:
This block of code is responsible for recording timers shown in the demo.
prometheus.timer('contact_form_total').start();
var emailInput = document.getElementById('email');
emailInput.addEventListener('focus', function(){
// You can run multiple timers on the same page
prometheus.timer('contact_form_writing').start();
});
var messageInput = document.getElementById('message');
messageInput.addEventListener('focus', function(){
// You can have multiple start points for the same timer, any repeated start() calls will not override the original start time
prometheus.timer('contact_form_writing').start();
});
function submitMessage(email, message){
// ... Message is submitted here
prometheus.timer('contact_form_writing').stop();
prometheus.timer('contact_form_total').stop();
// Currently, each timer should only be stopped in one place, but stopping multiple different timers together is fine
}
$('#contact-button').click(function(){
// ... Message is handled here
submitMessage(email, message);
});
Other Upgrades
- Bug Fix on v1.3.3: When tracking is turned off on localhost, login profiles will now no longer update on localhost either.
- Prometheus user tracking IDs will now be stored in
localStorage
instead ofsessionStorage
for persistence.
If you have any questions about these upgrades, please reach out to us.
About Us
Prometheus.js and PandorasBox.js were created by the development team at Omnipointment: the omnipotent appointment scheduling tool.
Feature Checks and Dashboard Show More
Prometheus.js is an open source CRM library built on top of Firebase and ReactFire. Prometheus brings the fire of specific user tracking to humanity so that you can gather crucial information about your users' experience and follow up. Available on npm.
The new upgrades to Prometheus make it easier for developers to customize their pages to users and cohorts as well as get more useful data, faster, from the analytics dashboard.
Prometheus: Feature Checks
The prometheus.deliver()
method runs functions asynchronously by checking if a user has been granted access via the given feature id. To allow developers to check access synchronously, we have added prometheus.has()
. The example below is from the mock Prometheus payment page:
var message = 'You have not paid yet.';
if(prometheus.has('paid')){
message = 'You are a paid user!';
}
var out = document.getElementById('pay-message');
out.innerText = message;
If the user has been granted access with the feature id "paid," then the .has()
method will return true.
How are the features checked?
Prometheus stores a list of the feature ids the user has been given access to in the browser's sessionStorage
. When Prometheus is initialized, an asynchronous Firebase request is made to update the list of feature ids. This is a live update, so if the webmaster grants a user access to a feature on the Pandora dashboard, it will be added to the sessionStorage
list in Firebase real time, though the user may have to refresh the page to gain access to the effects of this update.
The list is first updated when prometheus.logon()
is called, and as long as '.paid()is not used synchronously on the same page as the
.logon()` method, it should accurately return the feature ids the user has access to throughout the session.
Pandora: Show More
Previously, the Pandora analytics dashboard would slow down significantly when display records for users with more than 100 visits. In the updated dashboard, which can be downloaded here, only the ten latest visits show, allowing user modules to load faster. To go further back in a user's history, click the "Load More Visits" button, which will load more visits ten at a time.
Screenshot: Show more visits in Pandora Dashboard
Other Upgrades
- Prometheus will no longer track events on localhost by default. Turn tracking on for localhost by setting
{localhost: true}
in the config. - We now recommend, for ease of updating, that static websites using Prometheus initialize it in a common JavaScript file that is included in all pages, as shown here.
- User records in the dashboard now include the user's unique id (uid), which can be used to find them in your Firebase at
prometheus/users/{uid}
if needed. - Page metadata now displays in the Dashboard with the URL, page title, and an external link to that page.
- Browser metadata now includes the device type (
desktop
,tablet
, ormobile
) and the user's screen dimensions.
Screenshot: New user and visit views in Pandora Dashboard
If you have any questions about these upgrades, please reach out to us.
About Us
Prometheus.js and PandorasBox.js were created by the development team at Omnipointment: the omnipotent appointment scheduling tool.
Notifications
Prometheus.js is an open source CRM library built on top of Firebase and ReactFire. Prometheus brings the fire of specific user tracking to humanity so that you can gather crucial information about your users' experience and follow up. Available on npm.
Prometheus.js now includes the ability to deliver notifications to specific cohorts of users.
Prometheus: Notifications
Send popups to specific users via web notifications. (New Feature)
Demo
This visitor was selected as a small group of users to get a sneak preview of new features! When she clicked on the notification from Prometheus, she saw the information the web developers wanted her to. The team received record that they reached her, helpful, because even though we think this is a good way to reach users, we can't guarantee that every user will engage with the notifications developers set for them.
Usage
This feature is built on top of Prometheus' .deliver()
method. Assign notification IDs and add users under them in the Pandora Dashboard to specify which users should receive the prepared notification.
prometheus.notify(noteID, note, callback)
Send popups to specific users via web notifications.
- noteID (string, required): id used to group receiving users and notification return information
- note (object, required):
- title (string, optional): notification title.
- message (string, optional): notification body.
- icon (string, optional): notication icon.
- callback (function, optional): code to run if a user clicks on the notification body
Notification Callback
Notification callback functions include a Prometheus.Note object that has two methods for the developer to access.
function(note){
note.seen(); // Saves a Prometheus "NOTIFICATION_CLICKED" event for the user.
note.terminate(); // Removes the users' ID from the notification: they will not receive this notification unless it is reassigned to them from the dashboard.
}
If no callback function is provided, Note.seen()
will be called, but not Note.terminate()
.
Example from Demo:
This block of code is responsible for the notification shown in the demo gif.
prometheus.notify('features-note', {
title: "New Features",
message: "We're considering adding some new features. Click to reveal them.",
icon: "http://i.imgur.com/mUIQRVy.jpg"
}, function(){
var features = [
"Send web notifications to specific users from the dashboard.",
"Integrate with new Firebase 3.0 features."
];
var list = document.getElementById('feature-list');
list.innerHTML = '';
for(var i = 0; i < features.length; i++){
list.innerHTML += '<li>' + features[i] + '</li>';
}
});
If an icon is not specified in the note argument or the developer wishes to use one icon for all notifications, they can reference its URL with the icon variable in the Prometheus configuration. Individual icon URLs passed into the .notify()
function have precedence over the config icon.
var prometheus = Prometheus({
apiKey: "...",
...
icon: "https://v.cdn.vine.co/r/avatars/453D86296A1289362655722774528_4dd5b70336c.5.0.jpg"
});
If neither icon is specified, the icon used will be the Prometheus logo. ;)
Extensions
These are potential extensions of this feature that come to mind, not necessarily beneficial use cases.
- Add a UI for sending notifications to Pandora Dashboard, potentially stocking up an 'inbox' of notifications for users (if there will be many notifications, will need a less annoying delivery method than web notifications).
- Allow client to send data back through
.notify()
callback that gets recorded with theNOTIFICATION_CLICKED
event saved by Prometheus. - Allow for other conditions or user information to trigger the notification even if the user is not assigned to the notification ID in the Dashboard.
About Us
Prometheus.js and PandorasBox.js were created by the development team at Omnipointment: the omnipotent appointment scheduling tool.
Published on npm
Prometheus.js is an open source CRM library built on top of Firebase and ReactFire. Prometheus brings the fire of specific user tracking to humanity so that you can gather crucial information about your users' experience and follow up.
PrometheusJS is now on npm!
Upgraded to Firebase 3.0
Prometheus.js is an open source CRM library built on top of Firebase and ReactFire. Prometheus brings the fire of specific user tracking to humanity so that you can gather crucial information about your users' experience and follow up. Pandora's Box is an analytics dashboard and hub for Prometheus.js that allows you to view tracked data in real time and safely deploy features or A/B tests to specific users.
Prometheus.js and Pandora's Box are now compatible with the updates to the Firebase API. The new initialization for Prometheus on your webpage looks like this:
var prometheus = Prometheus({
apiKey: "apiKey",
authDomain: "projectId.firebaseapp.com",
databaseURL: "https://databaseName.firebaseio.com",
storageBucket: "databaseName.appspot.com"
});
You can auto-generate the config above and upgrade to the new Firebase API by following the instructions on Firebase's web setup page. To upgrade your Pandora dashboard, update your config.js
file to look like this:
window.CONFIG = {
apiKey: "apiKey",
authDomain: "projectId.firebaseapp.com",
databaseURL: "https://databaseName.firebaseio.com",
storageBucket: "databaseName.appspot.com"
};
Read more about the Firebase upgrades here.
Acquisition and Retention Metrics
Prometheus.js is an open source CRM library built on top of Firebase and ReactFire. Prometheus brings the fire of specific user tracking to humanity so that you can gather crucial information about your users' experience and follow up. Pandora's Box is an analytics dashboard and hub for Prometheus.js that allows you to view tracked data in real time and safely deploy features or A/B tests to specific users.
New Features
Pandora's Box Dashboard
- Display basic metrics in Milestones Module: user acquisition and retention by month and leaderboard of loyalty in days.
Setup
Try out Prometheus on your website:
And download the dashboard:
About
Prometheus.js is an open source project started by the founders of Omnipointment. If you share our need for a better, free analytics tool, we hope you'll try it out and contribute to the repository!
Email: team@omnipointment.com
Gitter: gitter.im/vingkan/prometheus
Waffle: waffle.io/vingkan/prometheus