Adding google analytics

This commit is contained in:
Justin Walsh 2013-06-21 14:36:50 -05:00
parent 3d0a669de6
commit 9cba493280
5 changed files with 30 additions and 1 deletions

View File

@ -141,6 +141,13 @@ Include custom links in the sidebar.
}
}
###Google Analytics:
This will embed the google analytics tracking code.
{
"google_analytics": "UA-XXXXXXXXX-XX"
}
## Running Locally
You can run the docs locally using <a href="http://gruntjs.com/" target="_blank">Grunt.js</a> I assume you are familiar with how to use Grunt and have the latest version of PHP 5.4 installed which is able to run a webserver.

View File

@ -141,6 +141,13 @@ Include custom links in the sidebar.
}
}
###Google Analytics:
This will embed the google analytics tracking code.
{
"google_analytics": "UA-XXXXXXXXX-XX"
}
## Running Locally
You can run the docs locally using <a href="http://gruntjs.com/" target="_blank">Grunt.js</a> I assume you are familiar with how to use Grunt and have the latest version of PHP 5.4 installed which is able to run a webserver.

View File

@ -5,6 +5,7 @@
"theme": "navy",
"repo": "justinwalsh/daux.io",
"twitter": ["justin_walsh", "todaymade"],
"google_analytics": "UA-12653604-10",
"links": {
"Github Repo": "https://github.com/justinwalsh/daux.io",
"Help/Support/Bugs": "https://github.com/justinwalsh/daux.io/issues",

View File

@ -266,5 +266,18 @@ if ($homepage && $homepage_url !== '/') {
</div>
</div>
<? } ?>
<? if ($options['google_analytics']) { ?>
<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', '<?=$options['google_analytics'];?>', '<?=$_SERVER['HTTP_HOST'];?>');
ga('send', 'pageview');
</script>
<? } ?>
</body>
</html>

View File

@ -34,7 +34,8 @@ function get_options() {
'repo' => false,
'twitter' => array(),
'links' => array(),
'colors' => false
'colors' => false,
'google_analytics' => false
);
// Load User Config