11import { addStyle } from "roamjs-components/dom" ;
22import { render as renderToast } from "roamjs-components/components/Toast" ;
3- import getCurrentUserUid from "roamjs-components/queries/getCurrentUserUid" ;
43import { runExtension } from "roamjs-components/util" ;
54import { queryBuilderLoadedToast } from "./data/toastMessages" ;
65import runQuery from "./utils/runQuery" ;
@@ -21,7 +20,6 @@ import discourseFloatingMenuStyles from "./styles/discourseFloatingMenuStyles.cs
2120import settingsStyles from "./styles/settingsStyles.css" ;
2221import discourseGraphStyles from "./styles/discourseGraphStyles.css" ;
2322import streamlineStyling from "./styles/streamlineStyling" ;
24- import posthog from "posthog-js" ;
2523import getDiscourseNodes from "./utils/getDiscourseNodes" ;
2624import { initFeedbackWidget } from "./components/BirdEatsBugs" ;
2725import {
@@ -38,53 +36,19 @@ import getBasicTreeByParentUid from "roamjs-components/queries/getBasicTreeByPar
3836import getPageUidByPageTitle from "roamjs-components/queries/getPageUidByPageTitle" ;
3937import { DISCOURSE_CONFIG_PAGE_TITLE } from "./utils/renderNodeConfigPage" ;
4038import { getSetting } from "./utils/extensionSettings" ;
41- import { STREAMLINE_STYLING_KEY } from "./data/userSettings" ;
42- import { getVersionWithDate } from "~/utils/getVersion" ;
43-
44- const initPostHog = ( ) => {
45- posthog . init ( "phc_SNMmBqwNfcEpNduQ41dBUjtGNEUEKAy6jTn63Fzsrax" , {
46- api_host : "https://us.i.posthog.com" ,
47- person_profiles : "identified_only" ,
48- capture_pageview : false ,
49- autocapture : false ,
50- loaded : ( posthog ) => {
51- const { version, buildDate } = getVersionWithDate ( ) ;
52- const userUid = getCurrentUserUid ( ) ;
53- const graphName = window . roamAlphaAPI . graph . name ;
54- posthog . identify ( userUid , {
55- graphName,
56- } ) ;
57- posthog . register ( {
58- version : version || "-" ,
59- buildDate : buildDate || "-" ,
60- graphName,
61- } ) ;
62- posthog . capture ( "Extension Loaded" ) ;
63- } ,
64- property_denylist : [
65- "$ip" , // Still seeing ip in the event
66- "$device_id" ,
67- "$geoip_city_name" ,
68- "$geoip_latitude" ,
69- "$geoip_longitude" ,
70- "$geoip_postal_code" ,
71- "$geoip_subdivision_1_name" ,
72- "$raw_user_agent" ,
73- "$current_url" ,
74- "$referrer" ,
75- "$referring_domain" ,
76- "$initial_current_url" ,
77- "$pathname" ,
78- ] ,
79- } ) ;
80- } ;
39+ import { initPostHog } from "./utils/posthog" ;
40+ import {
41+ STREAMLINE_STYLING_KEY ,
42+ DISALLOW_DIAGNOSTICS ,
43+ } from "./data/userSettings" ;
8144
8245export const DEFAULT_CANVAS_PAGE_FORMAT = "Canvas/*" ;
8346
8447export default runExtension ( async ( onloadArgs ) => {
8548 const isEncrypted = window . roamAlphaAPI . graph . isEncrypted ;
8649 const isOffline = window . roamAlphaAPI . graph . type === "offline" ;
87- if ( ! isEncrypted && ! isOffline ) {
50+ const disallowDiagnostics = getSetting ( DISALLOW_DIAGNOSTICS , false ) ;
51+ if ( ! isEncrypted && ! isOffline && ! disallowDiagnostics ) {
8852 initPostHog ( ) ;
8953 }
9054
0 commit comments