mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 10:01:40 -05:00
Pull out instrumentation stuff.
This commit is contained in:
parent
8d4682a558
commit
f2be21d496
2 changed files with 52 additions and 50 deletions
48
client/lib/instrumentation.js
Normal file
48
client/lib/instrumentation.js
Normal file
|
@ -0,0 +1,48 @@
|
|||
var instrumentRequest = function() {
|
||||
// Mixpanel
|
||||
if((mixpanelId=getSetting("mixpanelId")) && window.mixpanel.length===0 ){
|
||||
mixpanel.init(mixpanelId);
|
||||
if(Meteor.user()){
|
||||
var currentUserEmail=getCurrentUserEmail();
|
||||
mixpanel.people.identify(currentUserEmail);
|
||||
mixpanel.people.set({
|
||||
'username': getDisplayName(Meteor.user()),
|
||||
'$last_login': new Date(),
|
||||
'$created': moment(Meteor.user().createdAt)._d,
|
||||
'$email': currentUserEmail
|
||||
});
|
||||
mixpanel.register({
|
||||
'username': getDisplayName(Meteor.user()),
|
||||
'createdAt': moment(Meteor.user().createdAt)._d,
|
||||
'email': currentUserEmail
|
||||
});
|
||||
mixpanel.name_tag(currentUserEmail);
|
||||
}
|
||||
}
|
||||
|
||||
// GoSquared
|
||||
if (goSquaredId = getSetting("goSquaredId")) {
|
||||
GoSquared.acct = goSquaredId;
|
||||
GoSquaredInit();
|
||||
}
|
||||
|
||||
// Intercom
|
||||
if((intercomId=getSetting("intercomId")) && Meteor.user()){
|
||||
window.intercomSettings = {
|
||||
app_id: intercomId,
|
||||
email: currentUserEmail,
|
||||
created_at: moment(Meteor.user().createdAt).unix(),
|
||||
custom_data: {
|
||||
'profile link': 'http://'+document.domain+'/users/'+Meteor.user()._id
|
||||
},
|
||||
widget: {
|
||||
activator: '#Intercom',
|
||||
use_counter: true,
|
||||
activator_html: function ( obj ) {
|
||||
return obj.activator_html_functions.brackets();
|
||||
}
|
||||
}
|
||||
};
|
||||
IntercomInit();
|
||||
}
|
||||
}
|
|
@ -13,56 +13,10 @@ SimpleRouter = FilteredRouter.extend({
|
|||
|
||||
// set all errors who have been seen to not show anymore
|
||||
clearSeenErrors();
|
||||
|
||||
// Mixpanel
|
||||
|
||||
if((mixpanelId=getSetting("mixpanelId")) && window.mixpanel.length==0){
|
||||
mixpanel.init(mixpanelId);
|
||||
if(Meteor.user()){
|
||||
var currentUserEmail=getCurrentUserEmail();
|
||||
mixpanel.people.identify(currentUserEmail);
|
||||
mixpanel.people.set({
|
||||
'username': getDisplayName(Meteor.user()),
|
||||
'$last_login': new Date(),
|
||||
'$created': moment(Meteor.user().createdAt)._d,
|
||||
'$email': currentUserEmail
|
||||
});
|
||||
mixpanel.register({
|
||||
'username': getDisplayName(Meteor.user()),
|
||||
'createdAt': moment(Meteor.user().createdAt)._d,
|
||||
'email': currentUserEmail
|
||||
});
|
||||
mixpanel.name_tag(currentUserEmail);
|
||||
}
|
||||
}
|
||||
|
||||
// GoSquared
|
||||
|
||||
if((goSquaredId=getSetting("goSquaredId"))){
|
||||
GoSquared.acct = goSquaredId;
|
||||
GoSquaredInit();
|
||||
}
|
||||
|
||||
// Intercom
|
||||
if((intercomId=getSetting("intercomId")) && Meteor.user()){
|
||||
window.intercomSettings = {
|
||||
app_id: intercomId,
|
||||
email: currentUserEmail,
|
||||
created_at: moment(Meteor.user().createdAt).unix(),
|
||||
custom_data: {
|
||||
'profile link': 'http://'+document.domain+'/users/'+Meteor.user()._id
|
||||
},
|
||||
widget: {
|
||||
activator: '#Intercom',
|
||||
use_counter: true,
|
||||
activator_html: function ( obj ) {
|
||||
return obj.activator_html_functions.brackets();
|
||||
}
|
||||
}
|
||||
};
|
||||
IntercomInit();
|
||||
}
|
||||
|
||||
|
||||
// log this request with mixpanel, etc
|
||||
instrumentRequest();
|
||||
|
||||
return page;
|
||||
},
|
||||
require_login: function(page) {
|
||||
|
|
Loading…
Add table
Reference in a new issue