Skip to content

Commit

Permalink
fix: add gtag event
Browse files Browse the repository at this point in the history
  • Loading branch information
velopert committed Jan 2, 2024
1 parent b39405d commit 12f1524
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/containers/post/PostViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,12 +239,18 @@ const PostViewer: React.FC<PostViewerProps> = ({
if (!data?.post?.id) return;
if (!shouldShowBanner) return;
gtag('event', 'banner_view');
console.log('banner_view');

if (userId) {
gtag('event', 'banner_view_user');
}
}, [data?.post?.id, shouldShowBanner, userId]);

useEffect(() => {
if (customAd && (shouldShowBanner || shouldShowFooterBanner)) {
gtag('event', 'ads_banner_view');
}
}, [customAd, shouldShowBanner, shouldShowFooterBanner]);

const onRemove = async () => {
if (!data || !data.post) return;
try {
Expand Down

0 comments on commit 12f1524

Please sign in to comment.