Skip to content

Commit

Permalink
Merge pull request #38 from Gurubase/develop
Browse files Browse the repository at this point in the history
Fix mixpanel
  • Loading branch information
fatihbaltaci authored Jan 19, 2025
2 parents a6c4cc0 + 797b258 commit aea2da8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/gurubase-frontend/next.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const nextConfig = {
"frame-src 'self' *.auth0.com *.hotjar.com",
process.env.NEXT_PUBLIC_NODE_ENV === "selfhosted"
? "connect-src 'self' *"
: "connect-src 'self' localhost:* 127.0.0.1:* gurubase-backend:* *.getanteon.com *.amazonaws.com *.jsdelivr.net *.auth0.com *.iconify.design *.unisvg.com *.simplesvg.com *.hotjar.com *.hotjar.io wss://*.hotjar.com *.mixpanel.com *.google-analytics.com *.analytics.google.com",
: "connect-src 'self' localhost:* 127.0.0.1:* gurubase-backend:* *.getanteon.com *.amazonaws.com *.jsdelivr.net *.auth0.com *.iconify.design *.unisvg.com *.simplesvg.com *.hotjar.com *.hotjar.io wss://*.hotjar.com *.mixpanel.com *.google-analytics.com *.analytics.google.com *.sentry.io *.ingest.sentry.io",
"form-action 'self' *.auth0.com",
"object-src 'none'",
"base-uri 'self'",
Expand Down
2 changes: 1 addition & 1 deletion src/gurubase-frontend/src/components/HomePageClient.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"use client";
import React, { useEffect, useState } from "react";

import Footer from "@/components/Footer";
import GuruList from "@/components/GuruList";
import Header from "@/components/Header/index";
import mixpanel from "mixpanel-browser";

export default function HomePageClient({ allGuruTypes }) {
// check the environment development or production
Expand Down
25 changes: 13 additions & 12 deletions src/gurubase-frontend/src/components/ResultClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ import {
} from "@/redux/slices/mainFormSlice";
import { bingeRedirection } from "@/utils/bingeRedirection";
import { getStream } from "@/utils/clientActions";
import mixpanel from "mixpanel-browser";

export const ResultClient = ({
isHelpful,
Expand Down Expand Up @@ -143,18 +144,18 @@ export const ResultClient = ({
// // );
// }, [fingerprint]);

// useEffect(() => {
// if (!slug || typeof window === "undefined" || fingerprint) {
// return;
// }
// if (process.env.NEXT_PUBLIC_MIXPANEL_TOKEN) {
// mixpanel.init(process.env.NEXT_PUBLIC_MIXPANEL_TOKEN, { debug: false });
// mixpanel.track("Slug Visited", {
// slug: slug,
// guruType: guruType
// });
// }
// }, []);
useEffect(() => {
if (!slug || typeof window === "undefined" || fingerprint) {
return;
}
if (process.env.NEXT_PUBLIC_MIXPANEL_TOKEN) {
mixpanel.init(process.env.NEXT_PUBLIC_MIXPANEL_TOKEN, { debug: false });
mixpanel.track("Slug Visited", {
slug: slug,
guruType: guruType
});
}
}, []);

const [question, setQuestion] = useState(instantQuestion || reduxQuestion);
const [description, setDescription] = useState(
Expand Down

0 comments on commit aea2da8

Please sign in to comment.