[통합로그 No.2] Home 진입 후 Banner가 노출 될 때 노출 된 배너들의 정보를 수집 ( 롤링이 되면 롤링된 배너만 따로 로그 함수 호출 )
This commit is contained in:
@@ -1608,8 +1608,6 @@ export const sendLogTotalRecommend = (params) => (dispatch, getState) => {
|
|||||||
|
|
||||||
const logCreateTime = new Date().toISOString();
|
const logCreateTime = new Date().toISOString();
|
||||||
|
|
||||||
console.log("#entryMenu", entryMenu);
|
|
||||||
|
|
||||||
const newParams = {
|
const newParams = {
|
||||||
...params,
|
...params,
|
||||||
userNumber: userNumber,
|
userNumber: userNumber,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { types } from "../actions/actionTypes";
|
import { types } from '../actions/actionTypes';
|
||||||
import { panel_names } from "../utils/Config";
|
import { panel_names } from '../utils/Config';
|
||||||
|
|
||||||
const initialState = {
|
const initialState = {
|
||||||
termsData: {},
|
termsData: {},
|
||||||
@@ -19,6 +19,8 @@ const initialState = {
|
|||||||
bannerIndices: {},
|
bannerIndices: {},
|
||||||
themeMenuShelfInfoData: null,
|
themeMenuShelfInfoData: null,
|
||||||
homeInfo: null,
|
homeInfo: null,
|
||||||
|
curationId: "",
|
||||||
|
curationTitle: "",
|
||||||
};
|
};
|
||||||
|
|
||||||
export const homeReducer = (state = initialState, action) => {
|
export const homeReducer = (state = initialState, action) => {
|
||||||
@@ -66,6 +68,12 @@ export const homeReducer = (state = initialState, action) => {
|
|||||||
case types.GET_HOME_MAIN_CONTENTS: {
|
case types.GET_HOME_MAIN_CONTENTS: {
|
||||||
const homeTopDisplayInfo = action.payload?.homeTopDisplayInfos?.[0] ?? {};
|
const homeTopDisplayInfo = action.payload?.homeTopDisplayInfos?.[0] ?? {};
|
||||||
const bannerData = action.payload?.homeMainContentsBannerInfos?.[0] ?? {};
|
const bannerData = action.payload?.homeMainContentsBannerInfos?.[0] ?? {};
|
||||||
|
|
||||||
|
const curationTitle =
|
||||||
|
action.payload?.homeMainContentsBannerInfos?.[0].curtNm;
|
||||||
|
const curationId =
|
||||||
|
action.payload?.homeMainContentsBannerInfos?.[0].curationId;
|
||||||
|
|
||||||
if (bannerData.bannerInfos) {
|
if (bannerData.bannerInfos) {
|
||||||
for (let i = 0; i < bannerData.bannerInfos.length; i++) {
|
for (let i = 0; i < bannerData.bannerInfos.length; i++) {
|
||||||
const info = bannerData.bannerInfos[i];
|
const info = bannerData.bannerInfos[i];
|
||||||
@@ -79,6 +87,8 @@ export const homeReducer = (state = initialState, action) => {
|
|||||||
...state,
|
...state,
|
||||||
homeTopDisplayInfo: homeTopDisplayInfo,
|
homeTopDisplayInfo: homeTopDisplayInfo,
|
||||||
bannerData: bannerData,
|
bannerData: bannerData,
|
||||||
|
curationId,
|
||||||
|
curationTitle,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
case types.GET_THEME_CURATION_INFO:
|
case types.GET_THEME_CURATION_INFO:
|
||||||
|
|||||||
@@ -86,7 +86,7 @@ export default function RandomUnit({
|
|||||||
|
|
||||||
// 정상적으로 로딩되면 빈객체로 넘어가고 , 에러가 나면 객체안에 타입이 담겨옵니다.
|
// 정상적으로 로딩되면 빈객체로 넘어가고 , 에러가 나면 객체안에 타입이 담겨옵니다.
|
||||||
const broadcast = useSelector((state) => state.common.broadcast);
|
const broadcast = useSelector((state) => state.common.broadcast);
|
||||||
|
const { curationId, curationTitle } = useSelector((state) => state.home);
|
||||||
const [randomData, setRandomData] = useState("");
|
const [randomData, setRandomData] = useState("");
|
||||||
const [priceInfos, setpriceInfos] = useState("");
|
const [priceInfos, setpriceInfos] = useState("");
|
||||||
const [isFocused, setIsFocused] = useState(false);
|
const [isFocused, setIsFocused] = useState(false);
|
||||||
@@ -438,13 +438,27 @@ export default function RandomUnit({
|
|||||||
|
|
||||||
//통합로그
|
//통합로그
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
dispatch(
|
if (randomDataRef.current && nowMenu === LOG_MENU.HOME_TOP) {
|
||||||
sendLogTotalRecommend({
|
dispatch(
|
||||||
contextName: LOG_CONTEXT_NAME.HOME,
|
sendLogTotalRecommend({
|
||||||
messageId: LOG_MESSAGE_ID.BANNER,
|
contextName: LOG_CONTEXT_NAME.HOME,
|
||||||
})
|
messageId: LOG_MESSAGE_ID.BANNER,
|
||||||
);
|
curationId: curationId,
|
||||||
}, []);
|
curationTitle: curationTitle,
|
||||||
|
contentType: randomDataRef.current.shptmBanrTpNm,
|
||||||
|
contentId: "",
|
||||||
|
productId: randomDataRef.current.prdtId,
|
||||||
|
productTitle: randomDataRef.current.prdtNm,
|
||||||
|
displayType: "rolling",
|
||||||
|
partner: randomDataRef.current.patncNm,
|
||||||
|
brnad: randomDataRef.current.brndNm,
|
||||||
|
location: randomDataRef.current.dspyOrder,
|
||||||
|
bannerType:
|
||||||
|
randomDataRef.current.vtctpYn === "Y" ? "Vertical" : "Horizontal",
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}, [randomDataRef, nowMenu]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (bannerData) {
|
if (bannerData) {
|
||||||
|
|||||||
@@ -4,32 +4,55 @@ import React, {
|
|||||||
useMemo,
|
useMemo,
|
||||||
useRef,
|
useRef,
|
||||||
useState,
|
useState,
|
||||||
} from "react";
|
} from 'react';
|
||||||
|
|
||||||
import classNames from "classnames";
|
import classNames from 'classnames';
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import {
|
||||||
|
useDispatch,
|
||||||
|
useSelector,
|
||||||
|
} from 'react-redux';
|
||||||
|
|
||||||
import Spotlight from "@enact/spotlight";
|
import Spotlight from '@enact/spotlight';
|
||||||
import SpotlightContainerDecorator from "@enact/spotlight/SpotlightContainerDecorator";
|
import SpotlightContainerDecorator
|
||||||
import Spottable from "@enact/spotlight/Spottable";
|
from '@enact/spotlight/SpotlightContainerDecorator';
|
||||||
import { getContainerId } from "@enact/spotlight/src/container";
|
import Spottable from '@enact/spotlight/Spottable';
|
||||||
|
import { getContainerId } from '@enact/spotlight/src/container';
|
||||||
|
|
||||||
import btnPlay from "../../../../assets/images/btn/btn-play-thumb-nor.png";
|
import btnPlay from '../../../../assets/images/btn/btn-play-thumb-nor.png';
|
||||||
import defaultLogoImg from "../../../../assets/images/ic-tab-partners-default@3x.png";
|
import defaultLogoImg
|
||||||
import emptyHorImage from "../../../../assets/images/img-home-banner-empty-hor.png";
|
from '../../../../assets/images/ic-tab-partners-default@3x.png';
|
||||||
import emptyVerImage from "../../../../assets/images/img-home-banner-empty-ver.png";
|
import emptyHorImage
|
||||||
import defaultImageItem from "../../../../assets/images/img-thumb-empty-product@3x.png";
|
from '../../../../assets/images/img-home-banner-empty-hor.png';
|
||||||
import liveShow from "../../../../assets/images/tag-liveshow.png";
|
import emptyVerImage
|
||||||
import { setBannerIndex, updateHomeInfo } from "../../../actions/homeActions";
|
from '../../../../assets/images/img-home-banner-empty-ver.png';
|
||||||
import { sendLogTopContents } from "../../../actions/logActions";
|
import defaultImageItem
|
||||||
import { pushPanel } from "../../../actions/panelActions";
|
from '../../../../assets/images/img-thumb-empty-product@3x.png';
|
||||||
import { startVideoPlayer } from "../../../actions/playActions";
|
import liveShow from '../../../../assets/images/tag-liveshow.png';
|
||||||
import CustomImage from "../../../components/CustomImage/CustomImage";
|
import {
|
||||||
import usePriceInfo from "../../../hooks/usePriceInfo";
|
setBannerIndex,
|
||||||
import { LOG_MENU, LOG_TP_NO, panel_names } from "../../../utils/Config";
|
updateHomeInfo,
|
||||||
import { $L, formatGMTString } from "../../../utils/helperMethods";
|
} from '../../../actions/homeActions';
|
||||||
import { TEMPLATE_CODE_CONF } from "../HomePanel";
|
import {
|
||||||
import css from "./RollingUnit.module.less";
|
sendLogTopContents,
|
||||||
|
sendLogTotalRecommend,
|
||||||
|
} from '../../../actions/logActions';
|
||||||
|
import { pushPanel } from '../../../actions/panelActions';
|
||||||
|
import { startVideoPlayer } from '../../../actions/playActions';
|
||||||
|
import CustomImage from '../../../components/CustomImage/CustomImage';
|
||||||
|
import usePriceInfo from '../../../hooks/usePriceInfo';
|
||||||
|
import {
|
||||||
|
LOG_CONTEXT_NAME,
|
||||||
|
LOG_MENU,
|
||||||
|
LOG_MESSAGE_ID,
|
||||||
|
LOG_TP_NO,
|
||||||
|
panel_names,
|
||||||
|
} from '../../../utils/Config';
|
||||||
|
import {
|
||||||
|
$L,
|
||||||
|
formatGMTString,
|
||||||
|
} from '../../../utils/helperMethods';
|
||||||
|
import { TEMPLATE_CODE_CONF } from '../HomePanel';
|
||||||
|
import css from './RollingUnit.module.less';
|
||||||
|
|
||||||
const SpottableComponent = Spottable("div");
|
const SpottableComponent = Spottable("div");
|
||||||
|
|
||||||
@@ -74,7 +97,7 @@ export default function RollingUnit({
|
|||||||
|
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
const curationId = useSelector((state) => state.home?.bannerData?.curationId);
|
const { curationId, curationTitle } = useSelector((state) => state.home);
|
||||||
const curtNm = useSelector((state) => state.home?.bannerData?.curtNm);
|
const curtNm = useSelector((state) => state.home?.bannerData?.curtNm);
|
||||||
const shptmTmplCd = useSelector(
|
const shptmTmplCd = useSelector(
|
||||||
(state) => state.home?.bannerData?.shptmTmplCd
|
(state) => state.home?.bannerData?.shptmTmplCd
|
||||||
@@ -486,6 +509,31 @@ export default function RollingUnit({
|
|||||||
}
|
}
|
||||||
}, [dispatch, entryMenu, nowMenu, startIndex, topContentsLogInfo]);
|
}, [dispatch, entryMenu, nowMenu, startIndex, topContentsLogInfo]);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
if (rollingDataRef.current && nowMenu === LOG_MENU.HOME_TOP) {
|
||||||
|
dispatch(
|
||||||
|
sendLogTotalRecommend({
|
||||||
|
contextName: LOG_CONTEXT_NAME.HOME,
|
||||||
|
messageId: LOG_MESSAGE_ID.BANNER,
|
||||||
|
curationId: curationId,
|
||||||
|
curationTitle: curationTitle,
|
||||||
|
contentType: rollingDataRef.current[startIndex].shptmBanrTpNm,
|
||||||
|
contentId: "",
|
||||||
|
productId: rollingDataRef.current[startIndex].prdtId,
|
||||||
|
productTitle: rollingDataRef.current[startIndex].prdtNm,
|
||||||
|
displayType: "rolling",
|
||||||
|
partner: rollingDataRef.current[startIndex].patncNm,
|
||||||
|
brnad: rollingDataRef.current[startIndex].brndNm,
|
||||||
|
location: rollingDataRef.current[startIndex].dspyOrder,
|
||||||
|
bannerType:
|
||||||
|
rollingDataRef.current[startIndex].vtctpYn === "Y"
|
||||||
|
? "Vertical"
|
||||||
|
: "Horizontal",
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}, [rollingDataRef, nowMenu, startIndex]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (nowMenu !== LOG_MENU.HOME_TOP) {
|
if (nowMenu !== LOG_MENU.HOME_TOP) {
|
||||||
arrRef.current = [];
|
arrRef.current = [];
|
||||||
|
|||||||
Reference in New Issue
Block a user