Skip to content

Commit ea4e70c

Browse files
authored
remove posthog occurrences (#1321)
1 parent 9d91c9a commit ea4e70c

File tree

18 files changed

+4
-288
lines changed

18 files changed

+4
-288
lines changed

apps/core/lib/core/pubsub/consumers/posthog.ex

Lines changed: 0 additions & 16 deletions
This file was deleted.

apps/core/mix.exs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ defmodule Core.MixProject do
8585
{:ex_aws, "~> 2.4.0"},
8686
{:ex_aws_s3, "~> 2.3.3"},
8787
{:ex_aws_sts, "~> 2.3.0"},
88-
{:posthog, "~> 0.1"},
8988
{:configparser_ex, "~> 4.0"},
9089
{:sweet_xml, "~> 0.7.3"},
9190
{:arc_ecto, "~> 0.11.3"},

apps/core/test/pubsub/posthog/repositories_test.exs

Lines changed: 0 additions & 34 deletions
This file was deleted.

apps/core/test/pubsub/posthog/users_test.exs

Lines changed: 0 additions & 18 deletions
This file was deleted.

apps/core/test/test_helper.exs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,5 @@ Mimic.copy(Core.Services.Shell.Pods)
3333
Mimic.copy(Vault)
3434
Mimic.copy(System)
3535
Mimic.copy(Core.Clients.Vault)
36-
Mimic.copy(Posthog)
3736

3837
{:ok, _} = Application.ensure_all_started(:ex_machina)

config/config.exs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,6 @@ config :junit_formatter,
177177
print_report_file: true,
178178
automatic_create_dir?: true
179179

180-
config :posthog,
181-
api_url: "https://posthog.plural.sh",
182-
api_key: "phc_r0v4jbKz8Rr27mfqgO15AN5BMuuvnU8hCFedd6zpSDy"
183-
184180
config :core, :oidc_providers,
185181
github_actions: [
186182
discovery_document_uri: "https://token.actions.githubusercontent.com/.well-known/openid-configuration",

config/prod.exs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ config :core, :consumers, [
2929
Core.PubSub.Consumers.Audits,
3030
Core.PubSub.Consumers.Cache,
3131
Core.PubSub.Consumers.Usage,
32-
Core.PubSub.Consumers.Posthog
3332
]
3433

3534
config :email, :consumers, [

www/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,6 @@
7272
"moment": "2.29.4",
7373
"phoenix": "1.7.3",
7474
"pluralsh-absinthe-socket-apollo-link": "0.2.0",
75-
"posthog-js": "1.66.1",
7675
"process": "0.11.10",
7776
"prop-types": "15.8.1",
7877
"query-string": "8.1.0",

www/src/App.tsx

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import 'react-toggle/style.css'
2-
import { Suspense, lazy, useEffect } from 'react'
2+
import { Suspense, lazy } from 'react'
33
import { Route, Routes } from 'react-router-dom'
44
import { ApolloProvider } from '@apollo/client'
55
import { IntercomProvider } from 'react-use-intercom'
@@ -19,14 +19,12 @@ import styled, { ThemeProvider as StyledThemeProvider } from 'styled-components'
1919
import { mergeDeep } from '@apollo/client/utilities'
2020
import mpRecipe from 'honorable-recipe-mp'
2121
import { GrowthBook, GrowthBookProvider } from '@growthbook/growthbook-react'
22-
import posthog from 'posthog-js'
2322

2423
import { client } from './helpers/client'
2524
import { INTERCOM_APP_ID } from './constants'
2625
import { DEFAULT_THEME } from './theme'
2726
import { HistoryRouter, browserHistory } from './router'
2827
import { growthbook } from './helpers/growthbook'
29-
import Cookiebot from './utils/cookiebot'
3028
import { OverlayContextProvider } from './components/layout/Overlay'
3129
import NavContextProvider from './contexts/NavigationContext'
3230
import { CursorPositionProvider } from './components/utils/CursorPosition'
@@ -79,28 +77,6 @@ const SSOCallback = lazy(() =>
7977
}))
8078
)
8179

82-
function PosthogOptInOut() {
83-
useEffect(() => {
84-
if (Cookiebot?.consent?.statistics) {
85-
posthog.opt_in_capturing()
86-
} else {
87-
posthog.opt_out_capturing()
88-
}
89-
const onPrefChange = () => {
90-
if (Cookiebot?.consent?.statistics) {
91-
posthog.opt_in_capturing()
92-
} else {
93-
posthog.opt_out_capturing()
94-
}
95-
}
96-
97-
window.addEventListener('CookiebotOnAccept', onPrefChange)
98-
window.addEventListener('CookiebotOnDecline', onPrefChange)
99-
}, [])
100-
101-
return null
102-
}
103-
10480
const RootBoxSC = styled.div(({ theme }) => ({
10581
display: 'flex',
10682
flexdirection: 'column',
@@ -191,7 +167,6 @@ function App() {
191167

192168
return (
193169
<Suspense>
194-
<PosthogOptInOut />
195170
<ApolloProvider client={client}>
196171
<IntercomProvider appId={INTERCOM_APP_ID}>
197172
<ThemeProvider theme={honorableTheme}>

www/src/components/Plural.tsx

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import { Suspense, lazy, useContext, useEffect, useState } from 'react'
1+
import { Suspense, lazy, useEffect, useState } from 'react'
22
import { Navigate, Outlet, Route, Routes, useMatch } from 'react-router-dom'
33
import { Toast } from '@pluralsh/design-system'
44

55
import { growthbook } from '../helpers/growthbook'
66
import { useHistory } from '../router'
7-
import CurrentUserContext from '../contexts/CurrentUserContext'
8-
import PosthogIdentify from '../utils/posthog'
97

108
import { WrapStripe } from './WrapStripe'
119
import { LegacyExpirationNotice } from './login/LegacyExpiration'
@@ -296,23 +294,6 @@ function TestBanner() {
296294
return null
297295
}
298296

299-
function PosthogIdentifier() {
300-
const me = useContext(CurrentUserContext)
301-
302-
PosthogIdentify(me)
303-
304-
useEffect(() => {
305-
const onPrefChange = () => {
306-
PosthogIdentify(me)
307-
}
308-
309-
window.addEventListener('CookiebotOnAccept', onPrefChange)
310-
window.addEventListener('CookiebotOnDecline', onPrefChange)
311-
}, [me])
312-
313-
return null
314-
}
315-
316297
export function PluralInner() {
317298
return (
318299
<WrapStripe>
@@ -321,7 +302,6 @@ export function PluralInner() {
321302
<ApplicationLayout>
322303
<DelinquencyToast />
323304
<LegacyExpirationNotice />
324-
<PosthogIdentifier />
325305
<VerifyEmailConfirmed />
326306
<DeviceLoginNotif />
327307
<TestBanner />

0 commit comments

Comments
 (0)