Skip to content

Instantly share code, notes, and snippets.

@blaswan
Last active August 23, 2017 02:51
Show Gist options
  • Save blaswan/908d0e1c3adbe6ccfa47e95fb4114602 to your computer and use it in GitHub Desktop.
Save blaswan/908d0e1c3adbe6ccfa47e95fb4114602 to your computer and use it in GitHub Desktop.
構築メニュー → プロモーション管理 →任意アフィリエイト設定
<!-- Start Channel Plugin -->
<script>
window.channelPluginSettings = {
"plugin_id": '${YOUR_PLUGIN_ID}'
};
if ('$MEMBER_ID$' !== undefined && '$MEMBER_ID$' !== '' && '$MEMBER_ID$' !== null) {
window.channelPluginSettings.user = {
id: '$MEMBER_ID$',
meta: {}
};
if ('$ORDER_ID$' !== undefined && '$ORDER_ID$' !== '' && '$ORDER_ID$' !== null) {
window.channelPluginSettings.user.meta['受注コード'] = '$ORDER_ID$';
}
if ('$TOTAL_GOODS_AMOUNT$' !== undefined && '$TOTAL_GOODS_AMOUNT$' !== '' && '$TOTAL_GOODS_AMOUNT$' !== null) {
window.channelPluginSettings.user.meta['商品購入金額合計'] = '$TOTAL_GOODS_AMOUNT$';
}
if ('$TOTAL_BUY_COUNT_GOODS$' !== undefined && '$TOTAL_BUY_COUNT_GOODS$' !== '' && '$TOTAL_BUY_COUNT_GOODS$' !== null) {
window.channelPluginSettings.user.meta['商品購入数量合計'] = '$TOTAL_BUY_COUNT_GOODS$';
}
if ('$SEX$' !== undefined && '$SEX$' !== '' && '$SEX$' !== null) {
window.channelPluginSettings.user.meta['性別'] = decodeURI('$SEX$');
}
if ('$BIRTHDAY$' !== undefined && '$BIRTHDAY$' !== '' && '$BIRTHDAY$' !== null) {
window.channelPluginSettings.user.meta['生年月日'] = '$BIRTHDAY$';
}
}
(function() {
var node = document.createElement('div');
node.id = 'ch-plugin';
document.body.appendChild(node);
var async_load = function() {
var s = document.createElement('script');
s.type = 'text/javascript';
s.async = true;
s.src = '//cdn.channel.io/plugin/ch-plugin-web.js';
s.charset = 'UTF-8';
var x = document.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
};
if (window.attachEvent) {
window.attachEvent('onload', async_load);
} else {
window.addEventListener('load', async_load, false);
}
})();
</script>
<!-- End Channel Plugin -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment