Skip to content

Commit

Permalink
workarounds to get google analytics to work with manifest 2
Browse files Browse the repository at this point in the history
  • Loading branch information
cesine committed Sep 20, 2012
1 parent b1c2dc9 commit 4f6da50
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 5 deletions.
1 change: 1 addition & 0 deletions public/corpus.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<script type="text/javascript" src="./libs/require.js"></script>
<script type="text/javascript" src="./corpus_dashboard.js"></script>
<script type="text/javascript" src="./libs/d3.v2.js"></script>
<script type="text/javascript" src="./libs/ga.js"></script>
<script type="text/javascript" src="./libs/analytics.js"></script>


Expand Down
2 changes: 1 addition & 1 deletion public/libs/Utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ var Utils = Utils || {};
* is doing, how control flows through the app and also to debug new features or
* bugs.
*/
Utils.debugMode = true;
Utils.debugMode = false;


/**
Expand Down
14 changes: 10 additions & 4 deletions public/libs/analytics.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,13 @@
// pageTracker._trackPageview('/search_results.php?q=searchterm');


var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
var hndl = window.setTimeout("StartTracking()", 100);
// var gaJsHost = "https://ssl." ;
// document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
// console.log("Attempting to load "+ gaJsHost + "google-analytics.com/ga.js");
//Chrome manifest 2 doesnt work so put a static ga.js into the project.
var hndl = window.setTimeout(function() {
StartTracking();
}, 100);
function StartTracking(){
if (typeof(_gat) == 'object')
{
Expand All @@ -65,6 +69,8 @@
window.pageTracker._initData();
window.pageTracker._trackPageview();
} else {
hndl = window.setTimeout("StartTracking()", 1000);
hndl = window.setTimeout(function() {
StartTracking();
}, 1000);
}
}
Loading

1 comment on commit 4f6da50

@cesine
Copy link
Member Author

@cesine cesine commented on 4f6da50 Mar 1, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for #1881

Please sign in to comment.