Skip to content

Commit

Permalink
Add Google Analytics tracking.
Browse files Browse the repository at this point in the history
  • Loading branch information
0xdevalias committed Aug 4, 2013
1 parent 13c73c1 commit a7d4747
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
28 changes: 28 additions & 0 deletions js/googleAnalytics.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/**
* @overview Google Analytics asynchronous load
* @see http://developer.chrome.com/extensions/tut_analytics.html
* @see https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide
*/

var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-42943200-1']); // NOTE: Make sure you change this to your own Google Analytics code!!!
_gaq.push(['_trackPageview']);

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


// Note: This was the code provided when I setup Google Analytics. Newer version of?
// <script>
// (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
// (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
// m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
// })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

// ga('create', 'UA-42943200-1', 'chrome-newwindowwithtabstoright.net');
// ga('send', 'pageview');

// </script>
2 changes: 2 additions & 0 deletions manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"manifest_version": 2,
"description": "This extension creates a new window with the tabs to the right of the currently selected tab.",
"homepage_url": "http://devalias.net",
"content_security_policy": "script-src 'self' https://ssl.google-analytics.com; object-src 'self'",
"permissions": [
"tabs",
"contextMenus"
Expand All @@ -16,6 +17,7 @@
"default_locale": "en",
"background": {
"scripts": [
"js/googleAnalytics.js",
"js/chromeExtensionApiAbstractions.js",
"src/bg/background.js"
],
Expand Down

0 comments on commit a7d4747

Please sign in to comment.