Refactor user blocks into a single script tag.

This commit is contained in:
Paulo Reis 2016-07-14 09:47:25 +01:00
parent a261de9eb1
commit fee22db567

View file

@ -68,30 +68,17 @@ html(itemscope, itemtype='http://schema.org/Product')
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(cly, s);
})();
script(type="text/javascript")
if (session && session.user)
script(type="text/javascript").
Countly.q.push(['user_details', {
email: '#{session.user.email}',
custom: {
userId: '#{session.user._id}'
}
}]);
| Countly.q.push(['user_details', { email: '#{session.user.email}' }]);
if (justRegistered)
script(type="text/javascript").
Countly.q.push(['add_event',{
key: 'user-registered'
}]);
| Countly.q.push(['add_event',{ key: 'user-registered' }]);
if (justLoggedIn)
script(type="text/javascript").
| Countly.q.push(['add_event',{ key: 'user-logged-in' }]);
Countly.q.push(['add_event',{
key: 'user-logged-in'
}]);
if (user && user.features && Object.keys(user.features).length)
script(type="text/javascript")
if (user && user.features)
- featureFlagSet = false;
if user.features.collaborators