-- 2019/07/08 追記:イベント変数追加、トリガー設定 --
- {{SP_sale_event}} という DataLayer 変数を設定して「my_event」を取得し、バージョン 2 に設定しました。
- トリガーは、ページが「チェックアウト」ページ、購入フローの終了、別名「ありがとう」ページに移動したときです。
- ユニバーサル GA タグを設定し、ラベルを {{SP_sale_event}} に設定します。
- オリジナルメッセージ -
次のようなチェックアウトページにデータレイヤーを設定しました:
<script type="text/javascript">
dataLayer.push
({
'event': 'checkout',
'ecommerce': {
'purchase':{
'actionField':
{
'id': "<%=order.ID%>",
"affiliation": "Online Store",
"revenue": "<%=order.price%>"
}
}
}
});
$(window).load(function()
{
/**
* checkout data for GTM
*/
window.dataLayer = window.dataLayer || []
dataLayer.push
({
"transactionId":"<%=order.ID%>",
"transactionAffiliation":"My Online store",
"transactionTotal":"<%=order.price%>",
"transactionTax":"0",
"transactionShipping":"0",
"transactionProducts":
[
//some code about order detail ...
]
});
});
</script>
<script type="text/javascript">
dataLayer.push({
'my_event':'Sale event, purchased in <%=order.date%>, price: <%=order.price%>, orderID: <%=order.ID%>, member: <%=(order.isNew)?"New register":"old member"%>』'
});
</script>
そして、ラベル「my_event」をキャプチャするタグを GTM に設定します。
しかし、GA のイベント レポートでは、多くのイベントに有効なラベルが付いていませんが、代わりに (未設定) が付いています。
たとえば、GA レポートで 23 個の「my_event」が表示されますが、Label Sale イベントに付属するイベントは 3 つしかなく、購入したのは ...であり、他の 20 個のイベントは (設定されていない) グループに収集されています。
したがって、私の設定は時々機能しましたが、ほとんどの場合は機能しませんでした。
これを追跡して修正するにはどうすればよいですか?