(function () {
    'use strict';
    angular.module('ti_common').service('ticAnalyticsSrv', ticAnalyticsSrv);
    ticAnalyticsSrv.$inject = ['$http', '$location'];
    function ticAnalyticsSrv($http, $location) {
        function record(action, data) {
            var myData = data;
            if (data === undefined) {
                myData = {};
            }
            myData.app = "uniflash";
            myData.url = $location.path();
            var params = {
                "action": action,
                "data": myData
            };
            $http.post("/analytics", JSON.stringify(params)).
                success(function () { }).
                error(function () { });
        }
        ;
        return {
            record: record
        };
    }
})();
