Skip to content

Instantly share code, notes, and snippets.

@rakuishi
Last active February 4, 2016 00:51
Show Gist options
  • Save rakuishi/5010ee819260cdd32a15 to your computer and use it in GitHub Desktop.
Save rakuishi/5010ee819260cdd32a15 to your computer and use it in GitHub Desktop.
Google Analytics: Custom dimension をフィルターに含める
$result = $this->service->data_ga->get(
'ga:' . $viewId,
@date('Y-m-d', strtotime('-3 day')), // 開始日
@date('Y-m-d', strtotime('-2 day')), // 終了日
'ga:screenviews',
array(
'dimensions' => 'ga:screenName,ga:dimension1',
'sort' => '-ga:screenviews',
'max-results' => '10', // 件数
'filters' => 'ga:dimension1=@user', // `user` を含むカスタムディメンション 1 の値を検索
// == 一致, != 一致しない, =@ 含む, !@ 含まない, =~ 正規表現の一致, !~ 正規表現の不一致
)
);
@rakuishi
Copy link
Author

rakuishi commented Feb 2, 2016

@rakuishi
Copy link
Author

rakuishi commented Feb 2, 2016

Google Analytics 上でカスタムディメンションを見る方法

  1. 「ユーザー」→「サマリー」に移動する。
  2. 上に並んでいる「すべてのセッション」を選択する。
  3. 「新しいセグメント」を選択する。
  4. 「詳細」→「条件」を選択する。
  5. 「フィルタ」からカスタムディメンションの項目を選択し、適切な文言を指定する。
  6. 名前を付けて保存する。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment