Commit e1895d716aea9a5a994cd511f65ea60773ab1f52
1 parent
e7ad7849
Exists in
master
and in
5 other branches
Add piwik (issue #300)
Showing
3 changed files
with
25 additions
and
1 deletions
Show diff stats
js/main.js
1 | -define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, FastClick){ | |
1 | +define(['jquery', 'handlebars', 'fastclick', 'handlebars_helpers', 'piwik'], function($, Handlebars, FastClick){ | |
2 | 2 | |
3 | 3 | /* global Handlebars, $ */ |
4 | 4 | // The template code |
... | ... | @@ -494,6 +494,12 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F |
494 | 494 | lastHash = hash; |
495 | 495 | }, |
496 | 496 | navigateTo: function(hash, lastHash) { |
497 | + // _paq.push(['trackEvent', 'NavegarPara', hash || '/']); | |
498 | + // _paq.push(['setDocumentTitle', document.domain + '/' + hash]); | |
499 | + // _paq.push(['trackPageView']); | |
500 | + _paq.push(['trackPageView', 'navigateTo', hash, lastHash]); | |
501 | + // console.log('event tracked.'); | |
502 | + | |
497 | 503 | var scrollTop = 0; |
498 | 504 | var $nav = $('nav[role="tabpanel"]'); |
499 | 505 | var navOffset = $nav.offset(); | ... | ... |
... | ... | @@ -0,0 +1,13 @@ |
1 | +define(function(){ | |
2 | + var _paq = _paq || []; | |
3 | + _paq.push(["trackPageView"]); | |
4 | + _paq.push(["enableLinkTracking"]); | |
5 | + | |
6 | + (function() { | |
7 | + var u="http://estatisticas.presidencia.gov.br/"; | |
8 | + _paq.push(["setTrackerUrl", u+"piwik.php"]); | |
9 | + _paq.push(["setSiteId", "65"]); | |
10 | + var d=document, g=d.createElement("script"), s=d.getElementsByTagName("script")[0]; g.type="text/javascript"; | |
11 | + g.defer=true; g.async=true; g.src=u+"piwik.js"; s.parentNode.insertBefore(g,s); | |
12 | + })(); | |
13 | +}); | |
0 | 14 | \ No newline at end of file | ... | ... |
js/requirejs-config.js
... | ... | @@ -8,6 +8,7 @@ requirejs.config({ |
8 | 8 | baseUrl: base, |
9 | 9 | waitSeconds: 0, |
10 | 10 | paths: { |
11 | + piwik: 'piwik', | |
11 | 12 | jquery: 'jquery-2.1.3.min', |
12 | 13 | jquery_xdomainrequest: 'jquery.xdomainrequest.min', |
13 | 14 | jquery_ui: 'jquery-ui-1.11.4.custom/jquery-ui.min', |
... | ... | @@ -34,6 +35,9 @@ requirejs.config({ |
34 | 35 | 'jquery_xdomainrequest': { |
35 | 36 | deps: ['jquery'] |
36 | 37 | }, |
38 | + 'jquery_cookie': { | |
39 | + deps: ['jquery'] | |
40 | + }, | |
37 | 41 | 'jquery_timeago': { |
38 | 42 | deps: ['jquery'] |
39 | 43 | }, |
... | ... | @@ -74,5 +78,6 @@ requirejs.config({ |
74 | 78 | } |
75 | 79 | }); |
76 | 80 | |
81 | +requirejs(['piwik']); | |
77 | 82 | requirejs(['jquery', 'proposal_app', 'jquery_ui', 'jquery_xdomainrequest', 'jquery_timeago_pt', 'jquery_simplePagination', 'jquery_equalHeights', 'footable', 'handlebars_helpers']); |
78 | 83 | requirejs(['slick', 'fastclick', 'jquery_maxlength', 'layout','main']); | ... | ... |