branch develop updated (43a6ddc3 -> 62263a06)
This is an automated email from the git hooks/post-receive script. New change to branch develop in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git from 43a6ddc3 fixes #71 ajout du cron pour renvoyer les emails en erreur new 62263a06 fixes #57 analyse du trafic The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 62263a06e59e70891b4cf72b325dbdd1f653d419 Author: Kevin Morin <morin@codelutin.com> Date: Tue Jun 13 15:01:25 2017 +0200 fixes #57 analyse du trafic Summary of changes: pollen-ui-riot-js/package.json | 3 +- pollen-ui-riot-js/src/main/web/conf.js | 2 + pollen-ui-riot-js/src/main/web/js/PageTracker.js | 65 ++++++++++++++++++++++++ pollen-ui-riot-js/src/main/web/js/Poll.js | 13 +++++ pollen-ui-riot-js/src/main/web/js/PollForm.js | 9 +++- pollen-ui-riot-js/src/main/web/js/Session.js | 2 + 6 files changed, 92 insertions(+), 2 deletions(-) create mode 100644 pollen-ui-riot-js/src/main/web/js/PageTracker.js -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch develop in repository pollen. See https://gitlab.nuiton.org/chorem/pollen.git commit 62263a06e59e70891b4cf72b325dbdd1f653d419 Author: Kevin Morin <morin@codelutin.com> Date: Tue Jun 13 15:01:25 2017 +0200 fixes #57 analyse du trafic --- pollen-ui-riot-js/package.json | 3 +- pollen-ui-riot-js/src/main/web/conf.js | 2 + pollen-ui-riot-js/src/main/web/js/PageTracker.js | 65 ++++++++++++++++++++++++ pollen-ui-riot-js/src/main/web/js/Poll.js | 13 +++++ pollen-ui-riot-js/src/main/web/js/PollForm.js | 9 +++- pollen-ui-riot-js/src/main/web/js/Session.js | 2 + 6 files changed, 92 insertions(+), 2 deletions(-) diff --git a/pollen-ui-riot-js/package.json b/pollen-ui-riot-js/package.json index 8fcb8ae2..b33dc6f6 100644 --- a/pollen-ui-riot-js/package.json +++ b/pollen-ui-riot-js/package.json @@ -24,7 +24,7 @@ } ], "scripts": { - "start": "./node_modules/.bin/webpack-dev-server --hot --inline --host 0.0.0.0 --public felteu:8080", + "start": "./node_modules/.bin/webpack-dev-server --hot --inline --host 0.0.0.0 --public localhost:8080", "package": "./node_modules/.bin/webpack --bail" }, "devDependencies": { @@ -46,6 +46,7 @@ "moment": "^2.17.1", "nprogress": "^0.2.0", "object.values": "^1.0.4", + "piwik-tracker": "^1.1.1", "qrcode-generator": "^1.2.0", "remarkable": "^1.7.1", "riot": "^3.3.2", diff --git a/pollen-ui-riot-js/src/main/web/conf.js b/pollen-ui-riot-js/src/main/web/conf.js index 19b836c1..3d2517a3 100644 --- a/pollen-ui-riot-js/src/main/web/conf.js +++ b/pollen-ui-riot-js/src/main/web/conf.js @@ -1,5 +1,7 @@ window.pollenConf = { endPoint: "http://localhost:8888/pollen-rest-api", + piwikUrl: "http://localhost/piwik/", + piwikSiteId: "3", defaultErrorTimeout: 15, resourceMaxSize: 10000000 // octets => 10 Mo }; diff --git a/pollen-ui-riot-js/src/main/web/js/PageTracker.js b/pollen-ui-riot-js/src/main/web/js/PageTracker.js new file mode 100644 index 00000000..ad123210 --- /dev/null +++ b/pollen-ui-riot-js/src/main/web/js/PageTracker.js @@ -0,0 +1,65 @@ +let singleton = require("./Singleton"); +let PiwikTracker = require("piwik-tracker"); + +class PageTracker { + + constructor() { + if (pollenConf.piwikUrl && pollenConf.piwikSiteId) { + window._paq = window._paq || []; + _paq.push(['trackPageView']); + _paq.push(['enableLinkTracking']); + var u = pollenConf.piwikUrl; + _paq.push(['setTrackerUrl', u+'piwik.php']); + _paq.push(['setSiteId', pollenConf.piwikSiteId]); + var d = document, + g = d.createElement('script'); + g.type = 'text/javascript'; + g.async = true; + g.defer = true; + g.src = u + 'piwik.js'; + document.head.appendChild(g); + } + } + + _track(url) { + if (_paq) { + _paq.push(['setDocumentTitle', url]); + _paq.push(['setCustomUrl', "/" + url]); + _paq.push(['trackPageView']); + } + } + + trackLogin() { + this._track("login"); + } + + trackPoll() { + this._track("poll"); + } + + trackVote() { + this._track("vote"); + } + + trackResults() { + this._track("results"); + } + + trackComments() { + this._track("comments"); + } + + trackAddComment() { + this._track("newComment"); + } + + trackCreatePoll(step) { + this._track("newPoll" + step); + } + + trackPollCreated() { + this._track("pollCreated"); + } +} + +module.exports = singleton(PageTracker); diff --git a/pollen-ui-riot-js/src/main/web/js/Poll.js b/pollen-ui-riot-js/src/main/web/js/Poll.js index 1f9db91a..c16d2739 100644 --- a/pollen-ui-riot-js/src/main/web/js/Poll.js +++ b/pollen-ui-riot-js/src/main/web/js/Poll.js @@ -10,6 +10,7 @@ let Pagination = require("./Pagination"); let resourceService = require("./ResourceService"); let bus = require("./PollenBus.js"); let Error = require("./Error"); +let pageTracker = require("./PageTracker"); class Poll { @@ -156,6 +157,9 @@ class Poll { if (this.canVote) { this.voterName = resultsArray[indexResult++].voterName; } + + pageTracker.trackPoll(); + bus.trigger("poll", this); return Promise.resolve(this); }); @@ -186,6 +190,9 @@ class Poll { this.choices.forEach(choice => { choice.score = this.results.scores.find(score => score.choiceId === choice.id); }); + + pageTracker.trackResults(); + bus.trigger("poll", this); return Promise.resolve(this); } @@ -231,6 +238,9 @@ class Poll { this.comments = result[0].elements; this.commentCount = result[0].elements.length; this.authorName = result[1].authorName; + + pageTracker.trackComments(); + bus.trigger("poll", this); return Promise.resolve(this); }); @@ -266,6 +276,8 @@ class Poll { addVote(vote) { if (this.id) { return voteService.addVote(this.id, vote, this.votePermission || this.permission).then((result) => { + pageTracker.trackVote(); + this.voteId = result.id; this.votePermission = result.permission; return this.reloadPoll().then(() => { @@ -305,6 +317,7 @@ class Poll { text: text }; return commentService.createComment(this.id, form, this.permission || this.votePermission).then(() => { + pageTracker.trackAddComment(); return this.loadComments(); }); } diff --git a/pollen-ui-riot-js/src/main/web/js/PollForm.js b/pollen-ui-riot-js/src/main/web/js/PollForm.js index f2f1b6c5..9abd9b4d 100644 --- a/pollen-ui-riot-js/src/main/web/js/PollForm.js +++ b/pollen-ui-riot-js/src/main/web/js/PollForm.js @@ -40,7 +40,9 @@ class PollForm { ]; this.pollService = require("./PollService"); this.FormHelper = require("./FormHelper"); + this.pageTracker = require("./PageTracker"); this.step = -1; + this.maxStepReached = -1; this.isInit = false; this.choiceType = null; this.creation = false; @@ -131,7 +133,7 @@ class PollForm { }); this.isInit = true; - this.step = 0; + this.setStep(0); }); } @@ -156,6 +158,7 @@ class PollForm { logger.info(result); this.model.id = result.id; this.model.permission = result.permission; + this.pageTracker.trackPollCreated(); return Promise.resolve(); }, (error) => { @@ -238,6 +241,10 @@ class PollForm { setStep(step) { logger.info("setStep:: " + step); this.step = Math.min(this.steps.length, Math.max(0, step)); + if (this.step > this.maxStepReached) { + this.pageTracker.trackCreatePoll(this.step); + this.maxStepReached = this.step; + } } setSettingsDefault() { diff --git a/pollen-ui-riot-js/src/main/web/js/Session.js b/pollen-ui-riot-js/src/main/web/js/Session.js index 4b32882f..d3144848 100644 --- a/pollen-ui-riot-js/src/main/web/js/Session.js +++ b/pollen-ui-riot-js/src/main/web/js/Session.js @@ -23,6 +23,7 @@ let singleton = require("./Singleton"); let authService = require("./AuthService"); let bus = require("./PollenBus.js"); let logger = require("./Logger"); +let pageTracker = require("./PageTracker"); class Session { @@ -134,6 +135,7 @@ class Session { } logger.info("SignIn user::"); logger.info(user); + pageTracker.trackLogin(); this.user = user; bus.trigger("user", this.user); return this.user; -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm