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

Event Timeline

seungrye created this task.Jan 9 2015, 5:18 AM
seungrye raised the priority of this task from to Wishlist.
seungrye updated the task description. (Show Details)
seungrye added a subscriber: seungrye.
chad closed this task as Invalid.Jan 9 2015, 5:24 AM
chad claimed this task.
chad added a subscriber: chad.

I'd fork Phabricator and modify https://secure.phabricator.com/diffusion/P/browse/master/src/view/page/PhabricatorStandardPageView.php

(This isn't something we can provide additional support for here).

@chad // thanks always.

eadler updated the task description. (Show Details)Jan 26 2016, 6:20 PM
eadler added a subscriber: eadler.
eadler removed a subscriber: eadler.