Skip to content

Commit

Permalink
split out analytics to take advantage of coalescing
Browse files Browse the repository at this point in the history
  • Loading branch information
numist committed Feb 22, 2012
1 parent 282c880 commit fd8b147
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 27 deletions.
12 changes: 1 addition & 11 deletions analytics.inc
@@ -1,13 +1,3 @@
<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-432885-4']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();

<? require("offensive/js/analytics.js"); ?>
</script>
2 changes: 1 addition & 1 deletion offensive/index.php
Expand Up @@ -110,9 +110,9 @@ function query_string($remove = null, $prefix = "") {
if(function_exists('head')) {
head();
}
JS::add("/offensive/js/analytics.js");
CSS::emit();
JS::emit();
include_once("analytics.inc");
?>
</head>

Expand Down
9 changes: 9 additions & 0 deletions offensive/js/analytics.js
@@ -0,0 +1,9 @@
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-432885-4']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
29 changes: 14 additions & 15 deletions offensive/pages/pic.php
Expand Up @@ -81,20 +81,6 @@ function getFileSize( $fpath ) {
<link rel="prefetch" href="<?= $_SERVER['PHP_SELF'] ?>?id=<?= $upload->next_filtered()->id() ?>"/>
<? } ?> -->

<?
CSS::add("/styles/jquery-ui-1.8.17.custom.css");
CSS::add("/styles/pic.css");
CSS::emit();
JS::add("/offensive/js/jquery-1.7.1.min.js");
JS::add("/offensive/js/tmbolib.js");
JS::add("/offensive/js/jquery-ui-1.8.17.custom.min.js");
JS::add("/offensive/js/jquery.ba-outside-events.min.js");
JS::add("/offensive/js/subscriptions.js");
JS::add("/offensive/js/irsz.js");
JS::add("/offensive/js/picui.js");
JS::emit();

?>
<script type="text/javascript">
// handle a keybased event. this code was incorporated from offensive.js, which has now been deprecated
function handle_keypress(e)
Expand Down Expand Up @@ -178,7 +164,20 @@ function key_image_toggle() { theimage().irsz("toggle"); };
return true;
}
</script>
<? include_once("analytics.inc"); ?>
<?
CSS::add("/styles/jquery-ui-1.8.17.custom.css");
CSS::add("/styles/pic.css");
CSS::emit();
JS::add("/offensive/js/jquery-1.7.1.min.js");
JS::add("/offensive/js/tmbolib.js");
JS::add("/offensive/js/jquery-ui-1.8.17.custom.min.js");
JS::add("/offensive/js/jquery.ba-outside-events.min.js");
JS::add("/offensive/js/subscriptions.js");
JS::add("/offensive/js/irsz.js");
JS::add("/offensive/js/picui.js");
JS::add("/offensive/js/analytics.js");
JS::emit();
?>
</head>
<body id="pic">
<!-- message -->
Expand Down

0 comments on commit fd8b147

Please sign in to comment.