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 | /* global Handlebars, $ */ | 3 | /* global Handlebars, $ */ |
| 4 | // The template code | 4 | // The template code |
| @@ -494,6 +494,12 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | @@ -494,6 +494,12 @@ define(['handlebars', 'fastclick', 'handlebars_helpers'], function(Handlebars, F | ||
| 494 | lastHash = hash; | 494 | lastHash = hash; |
| 495 | }, | 495 | }, |
| 496 | navigateTo: function(hash, lastHash) { | 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 | var scrollTop = 0; | 503 | var scrollTop = 0; |
| 498 | var $nav = $('nav[role="tabpanel"]'); | 504 | var $nav = $('nav[role="tabpanel"]'); |
| 499 | var navOffset = $nav.offset(); | 505 | var navOffset = $nav.offset(); |
| @@ -0,0 +1,13 @@ | @@ -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 | \ No newline at end of file | 14 | \ No newline at end of file |
js/requirejs-config.js
| @@ -8,6 +8,7 @@ requirejs.config({ | @@ -8,6 +8,7 @@ requirejs.config({ | ||
| 8 | baseUrl: base, | 8 | baseUrl: base, |
| 9 | waitSeconds: 0, | 9 | waitSeconds: 0, |
| 10 | paths: { | 10 | paths: { |
| 11 | + piwik: 'piwik', | ||
| 11 | jquery: 'jquery-2.1.3.min', | 12 | jquery: 'jquery-2.1.3.min', |
| 12 | jquery_xdomainrequest: 'jquery.xdomainrequest.min', | 13 | jquery_xdomainrequest: 'jquery.xdomainrequest.min', |
| 13 | jquery_ui: 'jquery-ui-1.11.4.custom/jquery-ui.min', | 14 | jquery_ui: 'jquery-ui-1.11.4.custom/jquery-ui.min', |
| @@ -34,6 +35,9 @@ requirejs.config({ | @@ -34,6 +35,9 @@ requirejs.config({ | ||
| 34 | 'jquery_xdomainrequest': { | 35 | 'jquery_xdomainrequest': { |
| 35 | deps: ['jquery'] | 36 | deps: ['jquery'] |
| 36 | }, | 37 | }, |
| 38 | + 'jquery_cookie': { | ||
| 39 | + deps: ['jquery'] | ||
| 40 | + }, | ||
| 37 | 'jquery_timeago': { | 41 | 'jquery_timeago': { |
| 38 | deps: ['jquery'] | 42 | deps: ['jquery'] |
| 39 | }, | 43 | }, |
| @@ -74,5 +78,6 @@ requirejs.config({ | @@ -74,5 +78,6 @@ requirejs.config({ | ||
| 74 | } | 78 | } |
| 75 | }); | 79 | }); |
| 76 | 80 | ||
| 81 | +requirejs(['piwik']); | ||
| 77 | requirejs(['jquery', 'proposal_app', 'jquery_ui', 'jquery_xdomainrequest', 'jquery_timeago_pt', 'jquery_simplePagination', 'jquery_equalHeights', 'footable', 'handlebars_helpers']); | 82 | requirejs(['jquery', 'proposal_app', 'jquery_ui', 'jquery_xdomainrequest', 'jquery_timeago_pt', 'jquery_simplePagination', 'jquery_equalHeights', 'footable', 'handlebars_helpers']); |
| 78 | requirejs(['slick', 'fastclick', 'jquery_maxlength', 'layout','main']); | 83 | requirejs(['slick', 'fastclick', 'jquery_maxlength', 'layout','main']); |