Skip to content

Instantly share code, notes, and snippets.

@1987yama3
Last active March 22, 2017 08:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 1987yama3/083d492b75652b7bcc78f7a903dfaa72 to your computer and use it in GitHub Desktop.
Save 1987yama3/083d492b75652b7bcc78f7a903dfaa72 to your computer and use it in GitHub Desktop.
E-Commerce DataLayer
<script type="text/javascript">
var dataLayer = dataLayer || [];
dataLayer.push({
'site_type':'d',
'page_type' : 'TOPページ',
'customer': {
'id': 'C12345',
'hashed_email': '1234abcd'
},
'product': { // 商品詳細ページでなければこのプロパティは空
'id': 12345,
'price': 5400,
'category': 'AAA'
},
'transaction': { // transactionページでなければこのプロパティは空
'id': 'T12345',
'total': 9800,
'items': [
{'id':'#商品ID1#','price':'#単価1#','qty':'#数量1#'},
{'id':'#商品ID2#','price':'#単価2#','qty':'#数量2#'},
{'id':'#商品ID3#','price':'#単価3#','qty':'#数量3#'}
]
}
});
</script>
@1987yama3
Copy link
Author

GDN動的リマーケティング

ルックアップ変数「GoogleDynamicRemaketingPageType」

  • Input Var: {{page_type}}
  • Default Value: other
入力 出力
TOPページ home
検索結果 searchresults
商品詳細ページ product
... ...

リマーケティングタグのカスタムパラメーター

key value
ecomm_prodid {{product.id}}
ecomm_pagetype {{GoogleDynamicRemaketingPageType}}
ecomm_totalvalue {{product.price}}

@1987yama3
Copy link
Author

1987yama3 commented Mar 21, 2017

Googleアナリティクス・トランザクション(拡張eコマース)

カスタムJavaScript変数「GAトランザクション」

function () {
  return {
    'ecommerce': {
      'purchase': {
        'actionField': {
          'id': {{transaction.id}},
          'revenue': {{transaction.total}}
        },
        'products': {{transaction.items}}
      }
    }
  };
}

GAタグのeコマースイベント

  • 拡張eコマース機能を有効にする
  • 変数のデータを読む
    • GAトランザクション
  • トリガー
    • ページビューかつpage_type==トランザクション

@1987yama3
Copy link
Author

Adwords CV Tag

コンバージョンタグのカスタムパラメーター

key value
google_conversion_order_id {{transaction.id}}
google_conversion_value {{transaction.total}}

@1987yama3
Copy link
Author

YDNコンバージョンタグ

<script type="text/javascript" language="javascript">
  /* <![CDATA[ */
  var yahoo_ydn_conv_io = "~~~";
  var yahoo_ydn_conv_label = "~~~";
  var yahoo_ydn_conv_transaction_id = {{transaction.id}};
  var yahoo_ydn_conv_amount = {{transaction.total}};
  /* ]]> */
</script>
<script type="text/javascript" language="javascript" charset="UTF-8" src="//b90.yahoo.co.jp/conv.js"></script>

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