Authored by 于良

分类埋点 review by 草莓

... ... @@ -36,7 +36,7 @@ export default class KeywordCell extends React.Component {
/>
<View style={styles.textContainer}>
{list.toJS().map((item, i) => {
return <KeywordText key={i} keyword={item.keyword} androiddata={item.androiddata} onPressKeyword={onPressKeyword}/>;
return <KeywordText key={i} index={i} keyword={item.keyword} androiddata={item.androiddata} onPressKeyword={onPressKeyword}/>;
})}
</View>
... ...
... ... @@ -23,14 +23,14 @@ export default class KeywordText extends React.Component {
}
render() {
let {key, keyword, androiddata, onPressKeyword} = this.props;
let {index, keyword, androiddata, onPressKeyword} = this.props;
let textColor = this.state.helight ? {color: 'rgb(66, 66, 66)'} : {color: 'rgb(191, 191, 191)'};
return (
<TouchableHighlight
style={styles.container}
underlayColor={'rgb(255, 255, 255)'}
onPress={() => {
onPressKeyword && onPressKeyword(keyword, androiddata, key);
onPressKeyword && onPressKeyword(keyword, androiddata, index);
}}
onPressIn={() => {
this.setState({
... ...
... ... @@ -55,7 +55,7 @@ export default class InterestCell extends Component {
key={i}
activeOpacity={1}
onPress={() => {
this.props.onPressProduct && this.props.onPressProduct(item, i);
this.props.onPressProduct && this.props.onPressProduct(item, i, rowID);
}}
>
<View style={[styles.product, {marginLeft}]}>
... ...
... ... @@ -84,7 +84,7 @@ class BrandContainer extends Component {
}
//原生跳转
_onPressBrandItem(data){
_onPressBrandItem(data, fromSearch=false){
ReactNative.NativeModules.YH_CommonHelper.pushBrandVC(data);
let eventName = '';
... ... @@ -96,6 +96,10 @@ class BrandContainer extends Component {
eventName = 'YB_CATEGORY_BRAND_LIST_TEXT';
}
if (fromSearch) {
eventName = 'YB_CATEGORY_BRAND_LIST_TEXT';
}
let brandId = data.shop_id ? data.shop_id : '';
if (!brandId) {
brandId = data.id ? data.id : '';
... ... @@ -104,8 +108,8 @@ class BrandContainer extends Component {
BR_ID: brandId,
GDER: this.props.brand.selectedChannelId + '',
};
console.log(params)
// console.log(eventName)
// console.log(params)
NativeModules.YH_CommonHelper.logEvent(eventName, params);
}
... ... @@ -114,11 +118,11 @@ class BrandContainer extends Component {
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
let params = {
BAN_NUM: index + 1 + '',
BAN_NUM: parseInt(index) + 1 + '',
TOURL: url,
GDER: this.props.brand.selectedChannelId + '',
};
console.log(params)
NativeModules.YH_CommonHelper.logEvent('YB_CATEGORY_BRAND_LIST_BAN', params);
}
... ... @@ -126,17 +130,13 @@ class BrandContainer extends Component {
let url = data.url;
ReactNative.NativeModules.YH_CommonHelper.jumpWithUrl(url);
let brandId = data.shop_id ? data.shop_id : '';
if (!brandId) {
brandId = data.id ? data.id : '';
}
let brandId = brandId = data.id ? data.id : '';
let params = {
BAN_NUM: index + 1 + '',
BAN_NUM: parseInt(index) + 1 + '',
BR_ID: brandId,
GDER: this.props.brand.selectedChannelId + '',
};
console.log(params)
NativeModules.YH_CommonHelper.logEvent('YB_CATEGORY_BRAND_LIST_BR', params);
}
... ... @@ -144,9 +144,9 @@ class BrandContainer extends Component {
this.props.actions.setBrandFilter(value);
let params = {
CAT_NUM: value + 1 + '',
CAT_NUM: parseInt(value) + 1 + '',
};
console.log(params)
NativeModules.YH_CommonHelper.logEvent('YB_CATEGORY_BRAND_LIST_SG', params);
}
... ... @@ -195,7 +195,7 @@ class BrandContainer extends Component {
let params = {
CAT_NUM: channelId + '',
};
console.log(params)
NativeModules.YH_CommonHelper.logEvent('YB_CATEGORY_BRAND_LIST_CH', params);
}
... ... @@ -206,8 +206,8 @@ class BrandContainer extends Component {
let params = {
SEARCH_POS: '2',
};
console.log(params)
[[YH_Analytics sharedInstance] logEvent:'YB_SEARCH_CLICK' parameters:params];
NativeModules.YH_CommonHelper.logEvent('YB_SEARCH_CLICK', params);
}
}
... ... @@ -235,7 +235,7 @@ class BrandContainer extends Component {
}
_onPressBrandSearchItem(data) {
this._onPressBrandItem(data);
this._onPressBrandItem(data, true);
this.props.actions.insertSearchHistory(data);
this._onClickCancelSearch();
... ... @@ -245,8 +245,9 @@ class BrandContainer extends Component {
POS_ID: '0',
FLR_INDEX: '0',
};
console.log(params)
[[YH_Analytics sharedInstance] logEvent:'YB_BRAND_KEYWORD_SEARCH_C' parameters:params];
// console.log('YB_BRAND_KEYWORD_SEARCH_C')
// console.log(params)
NativeModules.YH_CommonHelper.logEvent('YB_BRAND_KEYWORD_SEARCH_C', params);
}
_onPressSearchHistoryItem(keyword, androiddata, index, section){
... ... @@ -266,11 +267,12 @@ class BrandContainer extends Component {
let params = {
KEYWORD: keyword,
POS_ID: section + 1 + '',
FLR_INDEX: index + 1 + '',
POS_ID: parseInt(section) + 1 + '',
FLR_INDEX: parseInt(index) + 1 + '',
};
console.log(params)
[[YH_Analytics sharedInstance] logEvent:'YB_BRAND_KEYWORD_SEARCH_C' parameters:params];
// console.log('YB_BRAND_KEYWORD_SEARCH_C')
// console.log(params)
NativeModules.YH_CommonHelper.logEvent('YB_BRAND_KEYWORD_SEARCH_C', params);
}
render() {
... ...
... ... @@ -102,11 +102,11 @@ class CategoryContainer extends Component {
channel = 4;
}
let params = {
CAT_NUM: catNum + 1 + '',
NAV_CAT_ID: index + 2 + '',
CAT_NUM: parseInt(catNum) + 1 + '',
NAV_CAT_ID: parseInt(navCatId) + '',
GDER: channel + '',
};
console.log(params)
NativeModules.YH_CommonHelper.logEvent('YB_CATEGORY_CAT_LIST', params);
}
... ...
... ... @@ -112,9 +112,11 @@ class InterestContainer extends Component {
}
let params = {
CAT_NUM: index + 1 + '',
CAT_NUM: parseInt(index) + 1 + '',
BR_ID: item.get('brand_id', ''),
};
// console.log('YB_CATEGORY_BRAND_TAB_FAV')
// console.log(params)
NativeModules.YH_CommonHelper.logEvent('YB_CATEGORY_BRAND_TAB_FAV', params);
}
... ... @@ -127,21 +129,25 @@ class InterestContainer extends Component {
NativeModules.YH_CommonHelper.jumpToBrand(item.toJS());
let params = {
CAT_NUM: index + 1 + '',
CAT_NUM: parseInt(index) + 1 + '',
NAV_NUM: '1',
BR_ID: item.get('brand_id', ''),
};
// console.log('YB_CATEGORY_BRAND_LIST_ATT')
// console.log(params)
NativeModules.YH_CommonHelper.logEvent('YB_CATEGORY_BRAND_LIST_ATT', params);
}
_onPressInterestProduct(item, index) {
_onPressInterestProduct(item, index, section) {
let url = item.url ? item.url : '';
NativeModules.YH_CommonHelper.jumpWithUrl(url);
let params = {
CAT_NUM: '1',
NAV_NUM: index + 2 + '',
CAT_NUM: parseInt(section) + 1 + '',
NAV_NUM: parseInt(index) + 1 + '',
};
// console.log('YB_CATEGORY_BRAND_LIST_ATT')
// console.log(params)
NativeModules.YH_CommonHelper.logEvent('YB_CATEGORY_BRAND_LIST_ATT', params);
}
... ...
... ... @@ -190,6 +190,8 @@ export function getBrandList(channel) {
}else if (channel == 4) {
dispatch(getBrandListForLifeStyleSuccess(payload));
}
dispatch(brandListDataExposure(json));
})
.catch(error => {
if (channel == 1) {
... ... @@ -354,6 +356,8 @@ export function getBrandResource(channel) {
}else if (channel == 4) {
dispatch(getBrandResourceForLifeStyleSuccess(payload));
}
dispatch(resourceDataExposure(json));
})
.catch(error => {
if (channel == 1) {
... ... @@ -678,3 +682,78 @@ export function setInitialListSize(count) {
dispatch(setInitialListSizePar(count));
}
}
function resourceDataExposure(json) {
return (dispatch, getState) => {
if (!json) {
return;
}
let hot = [];
let banner = [];
json.map((item) => {
if (item.template_name && item.template_name == 'focus') {
item.data && item.data.map((item2, i) => {
banner.push({
I_INDEX: i + 1,
IMAGE_URL: item2.src ? item2.src : '',
ACTION_URL: item2.url ? item2.url : '',
});
});
}
if (item.template_name && item.template_name == 'custom_brands') {
item.data && item.data.list && item.data.list.map((item2, i) => {
hot.push({
I_INDEX: i + 1,
SHOP_ID: '',
BRAND_ID: item2.id ? item2.id : '',
BRAND_NAME: item2.name ? item2.name : '',
IMAGE_URL: item2.src ? item2.src : '',
});
});
}
});
let params = {
HOTBRAND: hot,
BRANDBANNER: banner,
};
// console.log('YB_SHOW_BRANDBANNER')
// console.log(params)
ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_SHOW_BRANDBANNER', params);
};
}
function brandListDataExposure(json) {
return (dispatch, getState) => {
if (!json) {
return;
}
let {all_list, new_list, hot_list} = json;
let logAllList = {};
let logNewList = [];
let logHotList = [];
all_list && all_listmap((item) => {
});
let params = {
HOTBRAND: hot,
BRANDBANNER: banner,
};
console.log('YB_SHOW_BRANDLIST')
console.log(params)
// ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_SHOW_BRANDLIST', params);
};
}
... ...
... ... @@ -25,6 +25,8 @@ export function getCategory() {
.then(json => {
let payload=parseCategoryList(json);
dispatch(getCategorySuccess(payload));
dispatch(dataExposure(payload));
})
.catch(error => {
dispatch(getCategoryFailure(error));
... ... @@ -219,3 +221,95 @@ export function jumpToCategory(value, index, channel){
}
}
function dataExposure(json) {
return (dispatch, getState) => {
if (!json) {
return;
}
let {boy, girl, kids, lifestyle} = json;
let newBoy = [];
let newGirl = [];
let newKids = [];
let newLifestyle = [];
boy.map((item, i) => {
let subList = [];
item.sub && item.sub.map((sub, k) => {
subList.push({
I_INDEX: k + 1,
CAT_ID: sub.category_id,
});
});
newBoy.push({
I_INDEX: i + 1,
CAT_ID: item.category_id,
SUBLIST: subList,
});
});
girl.map((item, i) => {
let subList = [];
item.sub && item.sub.map((sub, k) => {
subList.push({
I_INDEX: k + 1,
CAT_ID: sub.category_id,
});
});
newGirl.push({
I_INDEX: i + 1,
CAT_ID: item.category_id,
SUBLIST: subList,
});
});
kids.map((item, i) => {
let subList = [];
item.sub && item.sub.map((sub, k) => {
subList.push({
I_INDEX: k + 1,
CAT_ID: sub.category_id,
});
});
newKids.push({
I_INDEX: i + 1,
CAT_ID: item.category_id,
SUBLIST: subList,
});
});
lifestyle.map((item, i) => {
let subList = [];
item.sub && item.sub.map((sub, k) => {
subList.push({
I_INDEX: k + 1,
CAT_ID: sub.category_id,
});
});
newLifestyle.push({
I_INDEX: i + 1,
CAT_ID: item.category_id,
SUBLIST: subList,
});
});
let params = {
YH_AppChannelBoy: newBoy,
YH_AppChannelGirl: newGirl,
YH_AppChannelKid: newKids,
YH_AppChannelLifeStyle: newLifestyle,
};
// console.log('YB_SHOW_CATEGORY')
// console.log(params)
ReactNative.NativeModules.YH_CommonHelper.logEvent('YB_SHOW_CATEGORY', params);
};
}
... ...
... ... @@ -155,6 +155,8 @@ export function interestList(reload=false) {
}
dispatch(interestListSuccess(payload));
dispatch(dataExposure('YB_SHOW_CONCERN', payload.logList));
})
.catch(error => {
dispatch(interestListFailure(error));
... ... @@ -191,9 +193,41 @@ function parseInterestList(json) {
let total = json && json.total ? json.total : 0;
let list = json && json.list ? json.list : [];
let logList = [];
list.map((item) => {
let productList = [];
let activityList = [];
item.product && item.product.map((product, i) => {
let logProduct = {
I_INDEX: i + 1,
PRD_ID: product.product_id ? product.product_id : '',
PRD_IMAGE: product.product_img ? product.product_img : '',
ACTION_URL: product.url ? product.url : '',
};
productList.push(logProduct);
});
if (item.brand_type == 'activity') {
activityList.push({
I_INDEX: 1,
ACT_IMAGE: item.img && item.img.src ? item.img.src : '',
ACTION_URL: item.img && item.img.url ? item.img.url : '',
});
}
let logItem = {
BRAND_ID: item.brand_id,
BRAND_IMG: item.brand_img,
PRD_LIST: productList,
ACTIVITY_LIST: activityList,
};
logList.push(logItem);
});
return {
list,
logList,
currentPage,
pageCount,
total,
... ... @@ -285,3 +319,20 @@ export function jumpWithUrl(url) {
payload: url
};
}
function dataExposure(eventName, data) {
return (dispatch, getState) => {
if (!eventName || !data || data.length == 0) {
return;
}
let params = {
DATA: data,
};
console.log(eventName)
console.log(params)
ReactNative.NativeModules.YH_CommonHelper.logEvent(eventName, params);
};
}
... ...
... ... @@ -13,7 +13,7 @@ export default class BrandService {
}
async getBrandList(yh_channel, fromPage='iFP_Brand'){
return await this.api.post({
return await this.api.get({
url: '',
body: {
method: 'app.brand.newBrandList',
... ... @@ -30,7 +30,7 @@ export default class BrandService {
}
async getBrandResource(content_code,fromPage='iFP_Brand'){
return await this.api.post({
return await this.api.get({
url: '/operations/api/v5/resource/get',
body: {
content_code,
... ...