Browse Source

Tracking hashchange

Jeroen De Meerleer 6 months ago
parent
commit
06dd5de3b5
1 changed files with 8 additions and 0 deletions
  1. 8 0
      src/JeroenED/PortfolioBundle/Resources/public/js/jeroened.js

+ 8 - 0
src/JeroenED/PortfolioBundle/Resources/public/js/jeroened.js

@@ -84,6 +84,14 @@ $(document).ready(function() {
     .attr("title","legacy environment");
 });
 
+window.onhashchange = function() {
+    if (!no_analytics) {
+        _paq.push(['setDocumentTitle', document.title]);
+        _paq.push(['trackPageView', window.location.href]);
+    }
+}
+
+
 window.onpopstate = function(e) {
     if (hastags) {
         var page = location.pathname;