googleアナリティクスでのトラッキング

「フォーム設定編集」でjavascriptを追加できるようになりました。
これを利用してトラッキングタグを埋め込むことができます。

※こちらは旧コードでの方法になりますので、
現行のユニバーサルトラッキングコードでの方法はこちらをご参照ください。

googleアナリティクスでアスメルのフォームをトラッキングするためには
クロスドメイントラッキングを行う必要があります。

クロスドメイントラッキングは次の手順で行うことができます。
1.トラッキングコードの設定
2.クロスリンクの設定

【1.トラッキングコードの設定】

複数のトップレベル ドメインをトラッキングして同じレポートにまとめて表示するには、各ドメインのページに同じトラッキング コードを設定します。
ただし、_setDomainName には必ずドメインごとに異なる値を設定します。

例えば「exapmle.com」というドメインにフォームを設置した場合、
設置するトラッキングタグは以下のようになります。

example.comに埋め込むトラッキングタグ

<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push([‘_setAccount’, ‘UA-XXXXXXXX-1’]);
_gaq.push([‘_setDomainName’, ‘example.com’]);
_gaq.push([‘_setAllowLinker’, true]);
_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>

アスメルの「フォーム設定の編集」で埋め込むタグ

<script type="text/javascript">

var _gaq = _gaq || [];
_gaq.push([‘_setAccount’, ‘UA-XXXXXXXX-1’]);
_gaq.push([‘_setDomainName’, ‘1lejend.com’]);
_gaq.push([‘_setAllowLinker’, true]);
_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>

【2.クロスリンクを設定する】

ホームページ側のフォーム

ホームページ上に設置したフォームタグを
以下のように変更してコードを追加します。

<form name="asumeru_form" method="post" action="https://1lejend.com/stepmail/kd.php" onsubmit="_gaq.push(['_linkByPost', this]);" >

アスメルの「フォーム設定の編集」で埋め込むタグ

先の手順でトラッキングタグが既に設置されているので、
続けて以下のコードを追加します。

<script type="text/javascript">
$(function(){
$("form").submit(function(){
_gaq.push(['_linkByPost', this]);
});
});
</script>

コメント