Merge branch 'develop' of github.com:HabitRPG/habitrpg into develop

This commit is contained in:
Blade Barringer 2015-04-08 19:47:21 -05:00
commit 695d5f9ef3
5 changed files with 13 additions and 13 deletions

View file

@ -472,7 +472,7 @@ api.wrap = (user, main=true) ->
task.value = 0
user.stats.hp = 50
cb? null, user
ga?.event('purchase', 'reroll').send()
ga?.event('behavior', 'gems', 'reroll').send()
rebirth: (req, cb, ga) ->
# Cost is 8 Gems ($2)
@ -533,7 +533,7 @@ api.wrap = (user, main=true) ->
user.stats.buffs = {}
# user.markModified? 'stats'
cb? null, user
ga?.event('purchase', 'Rebirth').send()
ga?.event('behavior', 'gems', 'rebirth').send()
allocateNow: (req, cb) ->
_.times user.stats.points, user.fns.autoAllocate
@ -749,7 +749,7 @@ api.wrap = (user, main=true) ->
user.items[type][key] = 0 unless user.items[type][key] > 0
user.items[type][key]++
cb? null, _.pick(user,$w 'items balance')
ga?.event('purchase', key).send()
ga?.event('behavior', 'gems', key).send()
releasePets: (req, cb) ->
if user.balance < 1
@ -898,7 +898,7 @@ api.wrap = (user, main=true) ->
user.balance -= cost
user.markModified? 'purchased'
cb? null, _.pick(user,$w 'purchased preferences')
ga?.event('purchase', path).send()
ga?.event('behavior', 'gems', path).send()
# ------
# Classes
@ -937,7 +937,7 @@ api.wrap = (user, main=true) ->
user.balance -= .75
_.merge user.stats, {str: 0, con: 0, per: 0, int: 0, points: user.stats.lvl}
user.flags.classSelected = false
ga?.event('purchase', 'changeClass').send()
ga?.event('behavior', 'gems', 'changeClass').send()
#'stats.points': this is handled on the server
cb? null, _.pick(user,$w 'stats flags items preferences')
@ -1567,7 +1567,7 @@ api.wrap = (user, main=true) ->
# Analytics
user.flags.cronCount?=0
user.flags.cronCount++
options.ga?.event('cron', user.flags.cronCount).send(); #TODO userId for cohort
options.ga?.event('behavior', 'cron', 'cron', user.flags.cronCount).send(); #TODO userId for cohort
# After all is said and done, progress up user's effect on quest, return those values & reset the user's
progress = user.party.quest.progress; _progress = _.cloneDeep progress

View file

@ -28,7 +28,7 @@ function($scope, $rootScope, User, $http, Notification, ApiUrl) {
// Google Analytics, only in production
if (window.env.NODE_ENV === 'production') {
// Get experiments API
$.getScript('//www.google-analytics.com/cx/api.js?experiment=wud1Ba5qT1m9qR3PP0-Mmg', function(){
$.getScript('//www.google-analytics.com/cx/api.js?experiment=pi26hZ3rRFaEPNiKqXbhqA', function(){
$rootScope.variant = cxApi.chooseVariation();
$rootScope.$apply();

View file

@ -165,7 +165,7 @@ function($rootScope, User, $timeout, $state) {
$state.go(step.state);
return $timeout(function(){});
}
window.ga && ga('send', 'event', 'tour', k, i+1);
window.ga && ga('send', 'event', 'behavior', 'tour', k, i+1);
}
step.onHide = function(){
if (step.final) { // -2 indicates complete

View file

@ -110,7 +110,7 @@ api.registerUser = function(req, res, next) {
newUser.preferences = newUser.preferences || {};
newUser.preferences.language = req.language; // User language detected from browser, not saved
var user = new User(newUser);
ga.event('register', 'Local').send();
ga.event('acquisition', 'register', 'local').send();
user.save(function(err, savedUser){
// Clean previous email preferences
EmailUnsubscription.remove({email: savedUser.auth.local.email}, function(){
@ -194,7 +194,7 @@ api.loginSocial = function(req, res, next) {
cb.apply(cb, arguments);
});
ga.event('register', network).send();
ga.event('acquisition', 'register', network).send();
}]
}, function(err, results){
if (err) return res.json(401, {err: err.toString ? err.toString() : err});

View file

@ -69,7 +69,7 @@ exports.createSubscription = function(data, cb) {
revealMysteryItems(recipient);
if(isProduction) {
if (!data.gift) utils.txnEmail(data.user, 'subscription-begins');
utils.ga.event('subscribe', data.paymentMethod).send();
utils.ga.event('commerce', 'subscribe', data.paymentMethod, block.price).send();
utils.ga.transaction(data.user._id, block.price).item(block.price, 1, data.paymentMethod.toLowerCase() + '-subscription', data.paymentMethod).send();
}
data.user.purchased.txnCount++;
@ -105,7 +105,7 @@ exports.cancelSubscription = function(data, cb) {
data.user.save(cb);
utils.txnEmail(data.user, 'cancel-subscription');
utils.ga.event('unsubscribe', data.paymentMethod).send();
utils.ga.event('commerce', 'unsubscribe', data.paymentMethod).send();
}
exports.buyGems = function(data, cb) {
@ -114,7 +114,7 @@ exports.buyGems = function(data, cb) {
data.user.purchased.txnCount++;
if(isProduction) {
if (!data.gift) utils.txnEmail(data.user, 'donation');
utils.ga.event('checkout', data.paymentMethod).send();
utils.ga.event('commerce', 'checkout', data.paymentMethod, amt).send();
//TODO ga.transaction to reflect whether this is gift or self-purchase
utils.ga.transaction(data.user._id, amt).item(amt, 1, data.paymentMethod.toLowerCase() + "-checkout", "Gems > " + data.paymentMethod).send();
}