Initial Analitys with Posthog

This commit is contained in:
Adolfo Reyna
2025-02-06 10:32:52 -05:00
parent caaed40476
commit 602081bf98
5 changed files with 89 additions and 11 deletions

View File

@@ -12,6 +12,7 @@ import { useSnapshot } from 'valtio';
import GlobalState from '../contexts/GlobalState.js';
import i18n from "../i18nMessages.js";
import ProfilePhotoCircle from './ProfilePhotoCircle.js';
import { posthog } from './../PostHog.js';
let Post = (props) => {
@@ -36,6 +37,12 @@ let Post = (props) => {
changeLikes(likes + 1);
newPostObj.reactions[viewer._id] = { type: "like" };
API.newPostReaction(post._id);
posthog.capture(
'post_clicked',
{
post_id: post._id,
}
);
} else {
changeLikes(likes - 1);
delete newPostObj.reactions[viewer._id];
@@ -73,10 +80,10 @@ let Post = (props) => {
{toProfileText}
</View>
<Text style={{ fontSize: 16, padding: 3, paddingLeft: 40 }}>{
cleanContent
}</Text>
<Text style={{ fontSize: 16, padding: 3, paddingLeft: 40 }}>{
cleanContent
}</Text>
<Media content={post.content} postId={post._id} post={post} style={{ paddingTop: 2 }} />
</View> :
<View>