mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 01:51:40 -05:00
added GoSquared analytics
This commit is contained in:
parent
086415c7c5
commit
a7907fa46d
5 changed files with 56 additions and 21 deletions
|
@ -12,6 +12,9 @@ Meteor.subscribe('comments', function() {
|
|||
|
||||
Settings = new Meteor.Collection('settings');
|
||||
Meteor.subscribe('settings', function(){
|
||||
|
||||
// runs once on site load
|
||||
|
||||
if((proxinoKey=getSetting('proxinoKey'))){
|
||||
Proxino.key = proxinoKey;
|
||||
Proxino.track_errors();
|
||||
|
@ -28,8 +31,43 @@ if (Meteor.is_client) {
|
|||
this.filter(this.start_request);
|
||||
},
|
||||
start_request: function(page){
|
||||
|
||||
// runs at every new page change
|
||||
|
||||
Session.set("error", null);
|
||||
Session.set("openedComments", null);
|
||||
document.title = getSetting("title");
|
||||
|
||||
// Mixpanel
|
||||
|
||||
if((mixpanelId=getSetting("mixpanelId")) && window.mixpanel.length==0){
|
||||
mixpanel.init(mixpanelId);
|
||||
if(Meteor.user()){
|
||||
var currentUserEmail=getCurrentUserEmail();
|
||||
console.log(currentUserEmail);
|
||||
mixpanel.people.identify(currentUserEmail);
|
||||
mixpanel.people.set({
|
||||
'username': Meteor.user().username,
|
||||
'$last_login': new Date(),
|
||||
'$created': moment(Meteor.user().createdAt)._d,
|
||||
'$email': currentUserEmail
|
||||
});
|
||||
mixpanel.register({
|
||||
'username': Meteor.user().username,
|
||||
'createdAt': moment(Meteor.user().createdAt)._d,
|
||||
'email': currentUserEmail
|
||||
});
|
||||
mixpanel.name_tag(currentUserEmail);
|
||||
}
|
||||
}
|
||||
|
||||
// GoSquared
|
||||
|
||||
if((goSquaredId=getSetting("goSquaredId"))){
|
||||
GoSquared.acct = goSquaredId;
|
||||
GoSquaredInit();
|
||||
}
|
||||
|
||||
return page;
|
||||
},
|
||||
require_login: function(page) {
|
||||
|
|
10
client/js/gosquared.js
Normal file
10
client/js/gosquared.js
Normal file
|
@ -0,0 +1,10 @@
|
|||
var GoSquared = {};
|
||||
|
||||
function GoSquaredInit(){
|
||||
window._gstc_lt = +new Date;
|
||||
var d = document, g = d.createElement("script");
|
||||
g.type = "text/javascript";
|
||||
g.src = "//d1l6p2sc9645hc.cloudfront.net/tracker.js";
|
||||
var s = d.getElementsByTagName("script")[0];
|
||||
s.parentNode.insertBefore(g, s);
|
||||
}
|
|
@ -11,28 +11,8 @@ Template.footer.helpers({
|
|||
});
|
||||
|
||||
Template.footer.rendered = function(){
|
||||
if((mixpanelId=getSetting("mixpanelId")) && window.mixpanel.length==0){
|
||||
mixpanel.init(mixpanelId);
|
||||
if(Meteor.user()){
|
||||
var currentUserEmail=getCurrentUserEmail();
|
||||
console.log(currentUserEmail);
|
||||
mixpanel.people.identify(currentUserEmail);
|
||||
mixpanel.people.set({
|
||||
'username': Meteor.user().username,
|
||||
'$last_login': new Date(),
|
||||
'$created': moment(Meteor.user().createdAt)._d,
|
||||
'$email': currentUserEmail
|
||||
});
|
||||
mixpanel.register({
|
||||
'username': Meteor.user().username,
|
||||
'createdAt': moment(Meteor.user().createdAt)._d,
|
||||
'email': currentUserEmail
|
||||
});
|
||||
mixpanel.name_tag(currentUserEmail);
|
||||
}
|
||||
}
|
||||
|
||||
document.title = getSetting("title");
|
||||
|
||||
}
|
||||
|
||||
Template.footer.events = {
|
||||
|
|
|
@ -41,6 +41,10 @@
|
|||
<label><a href="http://proxino.com" target="_blank">Proxino</a> key</label>
|
||||
<div class="controls"><input id="proxino_key" name="proxino_key" type="text" value="{{proxinoKey}}" /></div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label><a href="http://gosquared.com" target="_blank">GoSquared</a> ID</label>
|
||||
<div class="controls"><input id="gosquared_id" name="gosquared_id" type="text" value="{{goSquaredId}}" /></div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label>Logo URL</label>
|
||||
<div class="controls"><input id="logo_url" name="logo_url" type="text" value="{{logoUrl}}" /></div>
|
||||
|
|
|
@ -9,6 +9,7 @@ Template.settings.events = {
|
|||
var tlkioChannel = $('#tlkio_channel').val();
|
||||
var mixpanelId= $('#mixpanel_id').val();
|
||||
var proxinoKey=$('#proxino_key').val();
|
||||
var goSquaredId=$('#gosquared_id').val();
|
||||
var logoUrl=$('#logo_url').val();
|
||||
var logoHeight=$('#logo_height').val();
|
||||
var logoWidth=$('#logo_width').val();
|
||||
|
@ -25,6 +26,7 @@ Template.settings.events = {
|
|||
tlkioChannel: tlkioChannel,
|
||||
mixpanelId: mixpanelId,
|
||||
proxinoKey: proxinoKey,
|
||||
goSquaredId: goSquaredId,
|
||||
logoUrl: logoUrl,
|
||||
logoHeight: logoHeight,
|
||||
logoWidth: logoWidth,
|
||||
|
@ -42,6 +44,7 @@ Template.settings.events = {
|
|||
tlkioChannel: tlkioChannel,
|
||||
mixpanelId: mixpanelId,
|
||||
proxinoKey: proxinoKey,
|
||||
goSquaredId: goSquaredId,
|
||||
logoUrl: logoUrl,
|
||||
logoHeight: logoHeight,
|
||||
logoWidth: logoWidth,
|
||||
|
|
Loading…
Add table
Reference in a new issue