Skip to content

Commit

Permalink
Analytics add Kategorie tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
petrzjunior committed May 21, 2017
1 parent e046764 commit 02dc786
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion poznavacka/js/poznavacka.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,21 @@ poznavackaApp.controller("poznavackaCtrl", function($scope, $http, loaderService
$scope.setList = [];
$scope.imgList = [];

var setsChanged = false;
var selectedSets = [];

$scope.updateSelected = function() {
$scope.imgList = [];
selectedSets = [];
for (var index = 0; index < $scope.setList.length; index++) {
if ($scope.setList[index].enabled) {
$http.get($scope.setList[index].file).then(function(data) {
$scope.imgList = $scope.imgList.concat(data.data);
});
selectedSets.push($scope.setList[index]);
}
}
setsChanged = true;
};

var loadSets = function() {
Expand All @@ -22,7 +28,11 @@ poznavackaApp.controller("poznavackaCtrl", function($scope, $http, loaderService
$scope.next = function() {
$scope.showSolution = false;
$scope.thisOne = $scope.imgList[Math.floor((Math.random() * ($scope.imgList.length - 1)) + 0)];
console.log($scope.thisOne);
if (setsChanged) {
var selectedString = selectedSets.map(function(obj) { return obj.name; }).join(",");
ga('send', 'event', 'Poznávačka', 'Změna kategorie', selectedString);
setsChanged = false;
}
};
});

Expand Down

0 comments on commit 02dc786

Please sign in to comment.