Skip to content

Commit 12f1524

Browse files
committed
fix: add gtag event
1 parent b39405d commit 12f1524

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/containers/post/PostViewer.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,12 +239,18 @@ const PostViewer: React.FC<PostViewerProps> = ({
239239
if (!data?.post?.id) return;
240240
if (!shouldShowBanner) return;
241241
gtag('event', 'banner_view');
242-
console.log('banner_view');
242+
243243
if (userId) {
244244
gtag('event', 'banner_view_user');
245245
}
246246
}, [data?.post?.id, shouldShowBanner, userId]);
247247

248+
useEffect(() => {
249+
if (customAd && (shouldShowBanner || shouldShowFooterBanner)) {
250+
gtag('event', 'ads_banner_view');
251+
}
252+
}, [customAd, shouldShowBanner, shouldShowFooterBanner]);
253+
248254
const onRemove = async () => {
249255
if (!data || !data.post) return;
250256
try {

0 commit comments

Comments
 (0)