[통합로그 No.3] HomeBanner 클릭 시 배너의 대한 정보를 수집하는 로그 함수 호출

This commit is contained in:
dongyoungKo
2025-05-09 17:23:09 +09:00
parent 2374829a13
commit e2b45bc08b
2 changed files with 114 additions and 117 deletions

View File

@@ -4,55 +4,41 @@ import React, {
useMemo,
useRef,
useState,
} from 'react';
} from "react";
import classNames from 'classnames';
import {
useDispatch,
useSelector,
} from 'react-redux';
import classNames from "classnames";
import { useDispatch, useSelector } from "react-redux";
import Spotlight from '@enact/spotlight';
import SpotlightContainerDecorator
from '@enact/spotlight/SpotlightContainerDecorator';
import Spottable from '@enact/spotlight/Spottable';
import { getContainerId } from '@enact/spotlight/src/container';
import Spotlight from "@enact/spotlight";
import SpotlightContainerDecorator from "@enact/spotlight/SpotlightContainerDecorator";
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 defaultLogoImg
from '../../../../assets/images/ic-tab-partners-default@3x.png';
import emptyHorImage
from '../../../../assets/images/img-home-banner-empty-hor.png';
import emptyVerImage
from '../../../../assets/images/img-home-banner-empty-ver.png';
import defaultImageItem
from '../../../../assets/images/img-thumb-empty-product@3x.png';
import liveShow from '../../../../assets/images/tag-liveshow.png';
import {
setBannerIndex,
updateHomeInfo,
} from '../../../actions/homeActions';
import btnPlay from "../../../../assets/images/btn/btn-play-thumb-nor.png";
import defaultLogoImg from "../../../../assets/images/ic-tab-partners-default@3x.png";
import emptyHorImage from "../../../../assets/images/img-home-banner-empty-hor.png";
import emptyVerImage from "../../../../assets/images/img-home-banner-empty-ver.png";
import defaultImageItem from "../../../../assets/images/img-thumb-empty-product@3x.png";
import liveShow from "../../../../assets/images/tag-liveshow.png";
import { setBannerIndex, updateHomeInfo } from "../../../actions/homeActions";
import {
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';
} 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';
} 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");
@@ -185,6 +171,31 @@ export default function RollingUnit({
return {};
}, [shptmTmplCd, startIndex]);
const sendBannerLog = useCallback(() => {
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,
brand: rollingDataRef.current[startIndex].brndNm,
location: rollingDataRef.current[startIndex].dspyOrder,
bannerType:
rollingDataRef.current[startIndex].vtctpYn === "Y"
? "Vertical"
: "Horizontal",
})
);
}
}, [nowMenu, rollingDataRef]);
useEffect(() => {
if (savedIndex !== undefined) {
setStartIndex(savedIndex);
@@ -325,6 +336,7 @@ export default function RollingUnit({
if (bannerType === "Today's Deals") {
handlePushPanel(panel_names.DETAIL_PANEL, createPanelInfo(currentData));
sendBannerLog();
dispatch(
sendLogTopContents({
...topContentsLogInfo,
@@ -392,7 +404,7 @@ export default function RollingUnit({
default:
return;
}
sendBannerLog();
dispatch(
sendLogTopContents({
...topContentsLogInfo,
@@ -445,6 +457,7 @@ export default function RollingUnit({
modalClassName: css.videoModal,
});
sendBannerLog();
dispatch(
sendLogTopContents({
...topContentsLogInfo,
@@ -510,28 +523,7 @@ export default function RollingUnit({
}, [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",
})
);
}
sendBannerLog();
}, [rollingDataRef, nowMenu, startIndex]);
useEffect(() => {