Add analytics service to v3

This commit is contained in:
Blade Barringer
2015-11-11 06:36:28 -06:00
parent c91c3f78ed
commit cdb05e1b42
6 changed files with 608 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
import nconf from 'nconf';
import {
track,
trackPurchase,
mockAnalyticsService,
} from '../../libs/api-v3/analyticsService';
let service;
if (nconf.get('IS_PROD')) {
service = {
track,
trackPurchase,
};
} else {
service = mockAnalyticsService;
}
export default function attachAnalytics (req, res, next) {
res.analytics = service;
next();
}