Created
February 18, 2011 00:56
-
-
Save tmahesh/833066 to your computer and use it in GitHub Desktop.
Revisions
-
tmahesh revised this gist
Mar 7, 2011 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -13,7 +13,7 @@ try { if (!beacon.t_done || beacon.t_done < 0) return; var timeTaken = beacon.t_done; _gaq.push(['_trackEvent', pageType + 'PageLoad', getBucket(timeTaken), pageTitle, timeTaken]); } catch (e) {} } -
tmahesh created this gist
Feb 18, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,32 @@ <script type="text/javascript"> BOOMR.init({ beacon_url: "/boomerang.gif", BW: { enabled: false } }); BOOMR.subscribe('before_beacon', trackInAnalytics); var pageType = "homepage"; // customize this var pageTitle = "Measuring pageSpeed in GA"; // customize this function trackInAnalytics(beacon) { try { if (!beacon.t_done || beacon.t_done < 0) return; var timeTaken = beacon.t_done; _gaq.push(['_trackEvent', pageType + 'PageLoad', getBucket(timeTaken), pageTitle, Math.round(timeTaken / 100)]); } catch (e) {} } function getBucket(timeTaken) { var bucketString; var bucket = [1000, 1500, 2000, 2500, 3000, 3500, 4000, 4500, 5000, 5500, 6000, 6500, 7000, 7500, 8000, 9000, 10000, 15000, 20000, 30000, 45000, 60000]; for (var b = 0; b < bucket.length; b++) { if (timeTaken < bucket[b]) { bucketString = '< ' + bucket[b] / 1000 + 's'; break; } } if (!bucketString) bucketString = '> ' + bucket[bucket.length - 1] / 1000 + 's'; return bucketString; } </script>