Authored by 郝肖肖

微信商城 埋点

... ... @@ -141,6 +141,25 @@ function reMarginFooter(fixedElement) {
}
}
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
});
// 页面通用底部位置及status设置
(function() {
var $op = $footer.children('.op-row'),
... ... @@ -180,6 +199,12 @@ function reMarginFooter(fixedElement) {
}
$footer.removeClass('hide');
// 接受微信商城或者第三方来源的数据埋点信息
if (queryString().union_type) {
setCookie('union_type', queryString().union_type);
}
}());
(function(w, d, s, j, f) {
... ... @@ -195,7 +220,7 @@ function reMarginFooter(fixedElement) {
a.async = 1;
a.src = j;
m.parentNode.insertBefore(a, m);
})(window, document, 'script', (document.location.protocol === 'https:' ? 'https' : 'http') + '://cdn.yoho.cn/yas-jssdk/1.0.17/yas.js', '_yas');
}(window, document, 'script', (document.location.protocol === 'https:' ? 'https' : 'http') + '://cdn.yoho.cn/yas-jssdk/1.0.17/yas.js', '_yas'));
(function() {
var uid = getUid();
... ... @@ -270,24 +295,6 @@ $('.nav-home').on('touchstart', function() {
window.cancelAnimationFrame = cancelAnimationFrame;
}());
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
});
// 临时修改 footer
function phoneHidden(phone) {
... ...
... ... @@ -11,30 +11,25 @@ var floatLayerBtnHammer;
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;
}
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.sendCustomInfo && window._yas.sendCustomInfo) {
window._yas.sendCustomInfo({
op: 'YB_CHOOSE_FOR_YOU_Y',
param: JSON.stringify([])
}, true);
}
window.location = appUrl;
}
}, 500);
... ...