Page MenuHomePhabricator

How to add "google analystics" to phabricator ?
Closed, InvalidPublic

Description

I want to add "Google Analystics" to my phabricator instance.

But, It is difficult to find target (php source) to add analystics javascript as suggested method by google.

<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', 'XX-XXXXXX-XX', 'auto');
ga('send', 'YYYYY');
</script>

I read https://secure.phabricator.com/book/phabcontrib/article/adding_new_css_and_js/ and

  1. made javascript to .js file,
  2. locate $PHABRICATOR/webroot/rsrc/js/google/analystics.js and
  3. generate new map,
  4. run install_merge.sh

But I don't know where to add require_celerity_resource() function call.

I just want all pages would include that .js

Any suggestions?

PS. I try to use preamble.php, but if I put that javascript code before <!DOCTYPE html>..., phabricator working not properly.

SORRY FOR MY POOR ENGLISH