working on google analytics

This commit is contained in:
Sacha Greif 2013-10-30 08:27:44 +09:00
parent b09b475283
commit bef1ab8e0b
2 changed files with 9 additions and 4 deletions

View file

@ -1,4 +1,5 @@
analyticsInit = function() {
// Mixpanel
if (mixpanelId=getSetting("mixpanelId")){
(function (c, a) {
@ -57,21 +58,23 @@ analyticsInit = function() {
}
// Google Analytics
if ((googleAnalyticsId = getSetting("googleAnalyticsId"))){
if (googleAnalyticsId = getSetting("googleAnalyticsId")){
window._gaq = window._gaq || [];
_gaq.push(['_setAccount', googleAnalyticsId]);
window._gaq.push(['_setAccount', googleAnalyticsId]);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
}
}
analyticsRequest = function() {
// Google Analytics
if (googleAnalyticsId = getSetting("googleAnalyticsId") && window._gaq){
window._gaq.push(['_trackPageview', window.location.pathname]);

View file

@ -16,6 +16,7 @@ Session.set('settingsLoaded', false);
Meteor.subscribe('settings', function(){
// runs once after settings have loaded
Session.set('settingsLoaded',true);
analyticsInit();
});
// Categories
@ -32,4 +33,5 @@ if(Meteor.user() != null)
STATUS_PENDING=1;
STATUS_APPROVED=2;
STATUS_REJECTED=3;
STATUS_REJECTED=3;