Authored by 郝肖肖

下载APP 埋点

... ... @@ -13,6 +13,8 @@ var $footer = $('#yoho-footer'),
//为您优选-40位随机数指纹请求id
var RECID = (new Date().getTime() + '_H5_YOHOBUY_' + Math.floor(Math.random() * 1000000 + 1000000) + '_' + Math.floor(Math.random() * 1000000 + 1000000));
var _ChannelVary = {boys: 1, girls: 2, kids: 3, lifestyle: 4};
function cookie(name) {
var cookies = document.cookie,
cookieVal,
... ... @@ -126,6 +128,25 @@ function rePosFooter() {
}
}
function queryString() {
var vars = [],
hash,
i;
var hashes = window.location.search.slice(1).split('&');
for (i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
}
// 给jQuery 扩展 queryString函数
$.extend({
queryString: queryString;
});
/**
*
* add extra margin-bottom for footer to show yoho copyright when there is fixed bottom element on page
... ... @@ -188,6 +209,12 @@ function reMarginFooter(fixedElement) {
}
$footer.removeClass('hide');
// 接受微信商城或者第三方来源的数据埋点信息
if ($.queryString().union_type) {
setCookie('union_type', $.queryString().union_type);
}
}());
(function(w, d, s, j, f) {
... ... @@ -283,22 +310,9 @@ function givePoint(parameter) {
return false;
}
//男:1,女:2,潮童:3,创意生活:4
switch(cookie('_Channel')) {
case 'boys':
CID = 1;
break;
case 'girls':
CID = 2;
break;
case 'kids':
CID = 3;
break;
case 'lifestyle':
CID = 4;
break;
}
// 男:1,女:2,潮童:3,创意生活:4
CID = _ChannelVary[cookie('_Channel')] || 1;
parameter = $.extend({
'REC_POSE': '',
'REC_ID': RECID,
... ... @@ -391,23 +405,6 @@ $('.nav-home').on('touchstart', function() {
window.cancelAnimationFrame = cancelAnimationFrame;
}());
// 给jQuery 扩展 queryString函数
$.extend({
queryString: function() {
var vars = [],
hash,
i;
var hashes = window.location.search.slice(1).split('&');
for (i = 0; i < hashes.length; i++) {
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
}
});
//临时修改 footer
function phoneHidden(phone) {
return phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2');
... ... @@ -434,4 +431,8 @@ window.rePosFooter = rePosFooter;
window.reMarginFooter = reMarginFooter;
window.queryString = queryString();
window.givePoint = givePoint;
window._ChannelVary = _ChannelVary;
... ...
... ... @@ -7,34 +7,32 @@
var $ = require('jquery'),
Hammer = require('yoho.hammer');
var floatLayerBtnHammer;
var floatLayerBtnHammer,
C_ID;
require('../common');
/**
* 获取url参数
*/
function getQueryString(name) {
var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)', 'i');
var r = window.location.search.substr(1).match(reg);
if (r != null) {
return window.unescape(r[2]);
}
return null;
}
C_ID = window._ChannelVary[window.cookie('_Channel')] || 1;
function downLoadApp() {
var appUrl = 'http://www.yohoshow.com/about/index/yohobuyqr/';
var appUrl = 'http://union.yoho.cn/union/downapp.html';
var clickedAt = new Date();
setTimeout(function() {
var mkt = getQueryString('mkt_code');
var mkt = window.queryString.union_type || window.cookie('union_type') || false;
if ((new Date()) - clickedAt < 2000) {
if (mkt) {
appUrl += '?union_type=' + mkt;
}
if (window._yas && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_DOWNLOAD_C',
param: JSON.stringify({'C_ID': C_ID, 'TO_URL': appUrl})
}, true);
}
window.location = appUrl;
}
}, 500);
... ...