個人用ツール

「トーク:関数リファレンス/BcBaser googleAnalytics」の版間の差分

提供: baserCMS公式ガイド

移動: 案内, 検索
(ページの作成:「## 説明 Google Analyticsのトラッキングコードを出力します。 ## 使い方 <syntaxhighlight lang="php"> $this->BcBaser->googleanalytics(); </syntaxhighl...」)
 
(相違点なし)

2015年5月11日 (月) 13:06時点における版

説明

Google Analyticsのトラッキングコードを出力します。

使い方

$this->BcBaser->googleanalytics();

パラメータ

戻り値

(string)
スクリプトタグ

用例

基本

コード

<?php $this->BcBaser->googleanalytics(); ?>

出力

<script type="text/javascript">
 
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '【管理画面で設定したトラッキングコード】']);
_gaq.push(['_trackPageview']);
 
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
 
</script>

応用

コード

出力

変更履歴

ソースファイル

関連資料

類似の関数

getImg