Skip to content

Commit

Permalink
Merge pull request #52 from vinkla/google-analytics
Browse files Browse the repository at this point in the history
Add Google Analytics to environment file.
  • Loading branch information
vinkla committed Mar 18, 2015
2 parents 75c4e75 + a1318ab commit 3879921
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ DB_NAME=wordpress
DB_USER=homestead
DB_PASSWORD=secret

GOOGLE_ANALYTICS_KEY=

AUTH_KEY=yourrandomstring
SECURE_AUTH_KEY=yourrandomstring
LOGGED_IN_KEY=yourrandomstring
Expand Down
9 changes: 9 additions & 0 deletions wp-content/themes/boilerplate/footer.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
<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', '<?php echo getenv('GOOGLE_ANALYTICS_KEY'); ?>', 'auto');
ga('send', 'pageview');
</script>
<?php wp_footer(); ?>
</body>
</html>

0 comments on commit 3879921

Please sign in to comment.