Skip to content

Commit

Permalink
Merge pull request layer5io#5969 from sudhanshutech/posthog/identity
Browse files Browse the repository at this point in the history
add posthog identity and exclude some path
  • Loading branch information
sudhanshutech authored Oct 3, 2024
2 parents 8489c16 + 4a30fb2 commit ab58d70
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
3 changes: 3 additions & 0 deletions gatsby-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ export const onClientEntry = () => {
{
api_host: "https://us.i.posthog.com",
person_profiles: "always",
autocapture: {
url_ignorelist: ["community/newcomers", "/calendar", "/newcomers"]
}
}
);
}
Expand Down
9 changes: 9 additions & 0 deletions src/sections/General/Navigation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import CloudIcon from "./utility/CloudIcon.js";
import LogoutIcon from "./utility/LogoutIcon.js";
// import LogoutIcon from "./utility/LogoutIcon.js";
import KanvasIcon from "./utility/KanvasIcon.js";
import posthog from "posthog-js";
const Navigation = () => {
let data = useStaticQuery(
graphql`
Expand Down Expand Up @@ -212,6 +213,14 @@ const Navigation = () => {
}

const data = response.data;
if (data){
posthog.identify(
data?.id,
{
email: data?.email
}
);
}
setUserData(data);
} catch (error) {
console.error("There was a problem with your fetch operation:", error);
Expand Down

0 comments on commit ab58d70

Please sign in to comment.