Add Google Analytics to Ghost

ghostにGoogle Analyticsのトラッキングコードを埋め込む

埋め込む場所は/path/to/ghost/content/themes/<theme name>/default.hbs内のheadタグ内にある{{ghost_head}}の後ろに入れる

こんな感じ

<head>
    {{! Document Settings }}
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />

    {{! Page Meta }}
    <title>{{meta_title}}</title>
    <meta name="description" content="{{meta_description}}" />

    <meta name="HandheldFriendly" content="True" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />

    <link rel="shortcut icon" href="{{asset "favicon.ico"}}">

    {{! Styles'n'Scripts }}
    <link rel="stylesheet" type="text/css" href="{{asset "css/screen.css"}}" />
    <link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Merriweather:300,700,700italic,300italic|Open+Sans:700,400" />

    {{! Ghost outputs important style and meta data with this tag }}
    {{ghost_head}}

    <!-- 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', 'UA-12345678-9', 'auto');
      ga('send', 'pageview');

    </script>
    <!-- end google analytics -->

</head>

入れたらghostをリスタート(forever使っている場合)

$ forever stop
$ NODE_ENV=production forever -a -l /var/log/forever.log start /path/to/ghost/index.js

これでトラッキング開始される