/* * アクセス解析JS * -------------------------------------------------------------- * 作成日:2006/??/?? * 作成者:Netten * * -------------------------------------------------------------- * 説明 * アクセス解析用のJavaScript * PHP部分とJavaScript部分の分離が出来ていない欠点があります。 * * -------------------------------------------------------------- * 更新履歴 * 2006/05/19 猫の手 おくるまバージョン用に修正 * */ //■コンバーション用関数の実行 acc_ses_regist(); /** * ■解析スクリプト * ※この関数を実行した場所に見えないimgオブジェクトを出力します。 * ※body閉じタグ直上等で実行下さい。 * @param string title アクセス解析画面に表示される名称。ページ毎に分ける必要があります。 * @return void */ function acc_analisis( title ) { var temp; var ref; ref = window.document.referrer.replace(/&/g,"::"); temp = encodeURL( title ); document.write(""); } /** * ■コンバーション解析用タグの出力 * ※この関数を実行した場所に見えないimgオブジェクトを出力します。 * ※body閉じタグ直上等で実行下さい。 * @return void */ function acc_ses_regist() { var ref; ref = window.document.referrer; ref = ref.replace(/&/g,"::"); document.write(""); } /** * ■エンコード関数 * @param string str エンコード対象となる文字列 * @return string エンコードされた文字列 */ function encodeURL(str) { var character = ''; var unicode = ''; var string = ''; var i = 0; for (i = 0; i < str.length; i++) { character = str.charAt(i); unicode = str.charCodeAt(i); if (character == ' ') { string += '+'; } else { if (unicode == 0x2a || unicode == 0x2d || unicode == 0x2e || unicode == 0x5f || ((unicode >= 0x30) && (unicode <= 0x39)) || ((unicode >= 0x41) && (unicode <= 0x5a)) || ((unicode >= 0x61) && (unicode <= 0x7a))) { string = string + character; } else { if ((unicode >= 0x0) && (unicode <= 0x7f)) { character = '0' + unicode.toString(16); string += '%' + character.substr(character.length - 2); } else if (unicode > 0x1fffff) { string += '%' + (oxf0 + ((unicode & 0x1c0000) >> 18)).toString(16); string += '%' + (0x80 + ((unicode & 0x3f000) >> 12)).toString(16); string += '%' + (0x80 + ((unicode & 0xfc0) >> 6)).toString(16); string += '%' + (0x80 + (unicode & 0x3f)).toString(16); } else if (unicode > 0x7ff) { string += '%' + (0xe0 + ((unicode & 0xf000) >> 12)).toString(16); string += '%' + (0x80 + ((unicode & 0xfc0) >> 6)).toString(16); string += '%' + (0x80 + (unicode & 0x3f)).toString(16); } else { string += '%' + (0xc0 + ((unicode & 0x7c0) >> 6)).toString(16); string += '%' + (0x80 + (unicode & 0x3f)).toString(16); } } } } return string; }