diff --git a/bin/deploy-hobby b/bin/deploy-hobby
index 5e7f2f8bfb7e6..d57c81bc996d4 100755
--- a/bin/deploy-hobby
+++ b/bin/deploy-hobby
@@ -67,7 +67,7 @@ curl -o /dev/null -L --header "Content-Type: application/json" -d "{
\"properties\": {\"domain\": \"${DOMAIN}\"},
\"type\": \"capture\",
\"event\": \"magic_curl_install_start\"
-}" https://app.posthog.com/batch/ &> /dev/null
+}" https://us.i.posthog.com/batch/ &> /dev/null
# update apt cache
echo "Grabbing latest apt caches"
@@ -223,7 +223,7 @@ curl -o /dev/null -L --header "Content-Type: application/json" -d "{
\"properties\": {\"domain\": \"${DOMAIN}\"},
\"type\": \"capture\",
\"event\": \"magic_curl_install_complete\"
-}" https://app.posthog.com/batch/ &> /dev/null
+}" https://us.i.posthog.com/batch/ &> /dev/null
echo ""
echo "To stop the stack run 'docker-compose stop'"
echo "To start the stack again run 'docker-compose start'"
diff --git a/cypress/e2e/auto-redirect.cy.ts b/cypress/e2e/auto-redirect.cy.ts
index 748a41037cc4c..4cacef126c381 100644
--- a/cypress/e2e/auto-redirect.cy.ts
+++ b/cypress/e2e/auto-redirect.cy.ts
@@ -29,7 +29,7 @@ describe('Redirect to other subdomain if logged in', () => {
cy.visit(`/login?next=${redirect_path}`)
- cy.setCookie('ph_current_instance', `"app.posthog.com"`)
+ cy.setCookie('ph_current_instance', `"us.posthog.com"`)
cy.setCookie('is-logged-in', '1')
cy.reload()
diff --git a/frontend/src/layout.html b/frontend/src/layout.html
index f3468333c3d5a..f82afa51791d6 100644
--- a/frontend/src/layout.html
+++ b/frontend/src/layout.html
@@ -7,7 +7,7 @@
{% include "head.html" %}
([
}
if (event.data.type === 'external-navigation') {
- // This should only be triggered for app|eu.posthog.com links
+ // This should only be triggered for us|eu.posthog.com links
actions.handleExternalUrl(event.data.url)
return
}
diff --git a/frontend/src/lib/components/JSSnippet.tsx b/frontend/src/lib/components/JSSnippet.tsx
index 119d84622b9af..f3248a53fb628 100644
--- a/frontend/src/lib/components/JSSnippet.tsx
+++ b/frontend/src/lib/components/JSSnippet.tsx
@@ -3,13 +3,21 @@ import { CodeSnippet, Language } from 'lib/components/CodeSnippet'
import { apiHostOrigin } from 'lib/utils/apiHost'
import { teamLogic } from 'scenes/teamLogic'
-export function JSSnippet(): JSX.Element {
+export function useJsSnippet(indent = 0): string {
const { currentTeam } = useValues(teamLogic)
- return (
- {``}
- )
+ return [
+ '',
+ ]
+ .map((x) => ' '.repeat(indent) + x)
+ .join('\n')
+}
+
+export function JSSnippet(): JSX.Element {
+ const snippet = useJsSnippet()
+
+ return {snippet}
}
diff --git a/frontend/src/lib/utils/apiHost.ts b/frontend/src/lib/utils/apiHost.ts
index 6b47d8c9c8aea..d61f473573cef 100644
--- a/frontend/src/lib/utils/apiHost.ts
+++ b/frontend/src/lib/utils/apiHost.ts
@@ -1,8 +1,11 @@
export function apiHostOrigin(): string {
let apiHost = window.location.origin
- // similar to https://github.com/PostHog/posthog-js/blob/b79315b7a4fa0caded7026bda2fec01defb0ba73/src/posthog-core.ts#L1742
+
if (apiHost === 'https://us.posthog.com') {
- apiHost = 'https://app.posthog.com'
+ apiHost = 'https://us.i.posthog.com'
+ } else if (apiHost === 'https://eu.posthog.com') {
+ apiHost = 'https://eu.i.posthog.com'
}
+
return apiHost
}
diff --git a/frontend/src/scenes/feature-flags/FeatureFlagSnippets.tsx b/frontend/src/scenes/feature-flags/FeatureFlagSnippets.tsx
index 06037bb23c2ea..6130aa984820f 100644
--- a/frontend/src/scenes/feature-flags/FeatureFlagSnippets.tsx
+++ b/frontend/src/scenes/feature-flags/FeatureFlagSnippets.tsx
@@ -534,7 +534,7 @@ export function JSBootstrappingSnippet(): JSX.Element {
// This avoids the delay between the library loading and feature flags becoming available to use.
posthog.init('{project_api_key}', {
- api_host: 'https://app.posthog.com',
+ api_host: '${apiHostOrigin()}'
bootstrap:
{
distinctID: 'your-anonymous-id',
diff --git a/frontend/src/scenes/notebooks/NotebookTemplates/notebookTemplates.ts b/frontend/src/scenes/notebooks/NotebookTemplates/notebookTemplates.ts
index 3ff279c9b060f..f1c63fe133674 100644
--- a/frontend/src/scenes/notebooks/NotebookTemplates/notebookTemplates.ts
+++ b/frontend/src/scenes/notebooks/NotebookTemplates/notebookTemplates.ts
@@ -313,7 +313,7 @@ export const LOCAL_NOTEBOOK_TEMPLATES: NotebookType[] = [
__init: null,
children: null,
file: null,
- src: 'https://app.posthog.com/uploaded_media/018c494d-132b-0000-2004-8861f35c13b5',
+ src: 'https://us.posthog.com/uploaded_media/018c494d-132b-0000-2004-8861f35c13b5',
},
},
{
@@ -643,7 +643,7 @@ export const LOCAL_NOTEBOOK_TEMPLATES: NotebookType[] = [
__init: null,
children: null,
file: null,
- src: 'https://app.posthog.com/uploaded_media/018c496c-d79a-0000-bbc8-fdb0c77ec46f',
+ src: 'https://us.posthog.com/uploaded_media/018c496c-d79a-0000-bbc8-fdb0c77ec46f',
},
},
{
diff --git a/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/flutter.tsx b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/flutter.tsx
index 67e3a4a7799d3..e5164e93d378e 100644
--- a/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/flutter.tsx
+++ b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/flutter.tsx
@@ -1,5 +1,6 @@
import { useValues } from 'kea'
import { CodeSnippet, Language } from 'lib/components/CodeSnippet'
+import { useJsSnippet } from 'lib/components/JSSnippet'
import { apiHostOrigin } from 'lib/utils/apiHost'
import { teamLogic } from 'scenes/teamLogic'
@@ -38,8 +39,7 @@ function FlutterIOSSetupSnippet(): JSX.Element {
}
function FlutterWebSetupSnippet(): JSX.Element {
- const { currentTeam } = useValues(teamLogic)
- const url = apiHostOrigin()
+ const jsSnippet = useJsSnippet(4)
return (
@@ -47,10 +47,7 @@ function FlutterWebSetupSnippet(): JSX.Element {
...
-
+${jsSnippet}
diff --git a/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/next-js.tsx b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/next-js.tsx
index 2aa0271b2dee5..8b6a77fbdc3de 100644
--- a/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/next-js.tsx
+++ b/frontend/src/scenes/onboarding/sdks/sdk-install-instructions/next-js.tsx
@@ -27,7 +27,7 @@ import { PostHogProvider } from 'posthog-js/react'
if (typeof window !== 'undefined') { // checks that we are client-side
posthog.init(process.env.NEXT_PUBLIC_POSTHOG_KEY, {
- api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST || 'https://app.posthog.com',
+ api_host: process.env.NEXT_PUBLIC_POSTHOG_HOST || '${apiHostOrigin()}',
loaded: (posthog) => {
if (process.env.NODE_ENV === 'development') posthog.debug() // debug mode in development
},
diff --git a/frontend/src/scenes/toolbar-launch/ToolbarLaunch.tsx b/frontend/src/scenes/toolbar-launch/ToolbarLaunch.tsx
index b5f1602ec42ff..53dfd8769762e 100644
--- a/frontend/src/scenes/toolbar-launch/ToolbarLaunch.tsx
+++ b/frontend/src/scenes/toolbar-launch/ToolbarLaunch.tsx
@@ -48,7 +48,7 @@ function ToolbarLaunch(): JSX.Element {
Click on the URL to launch the toolbar.{' '}
- {window.location.host === 'app.posthog.com' && 'Remember to disable your adblocker.'}
+ {window.location.host.includes('.posthog.com') && 'Remember to disable your adblocker.'}
diff --git a/plugin-server/src/utils/posthog.ts b/plugin-server/src/utils/posthog.ts
index 2f6ada2300fb5..b63604628eb2f 100644
--- a/plugin-server/src/utils/posthog.ts
+++ b/plugin-server/src/utils/posthog.ts
@@ -1,7 +1,7 @@
import { PostHog } from 'posthog-node'
export const posthog = new PostHog('sTMFPsFhdP1Ssg', {
- host: 'https://app.posthog.com',
+ host: 'https://us.i.posthog.com',
})
if (process.env.NODE_ENV === 'test') {
diff --git a/posthog/ph_client.py b/posthog/ph_client.py
index e81161a59d470..9775ebd9a0334 100644
--- a/posthog/ph_client.py
+++ b/posthog/ph_client.py
@@ -14,10 +14,10 @@ def get_ph_client():
region = get_instance_region()
if region == "EU":
api_key = "phc_dZ4GK1LRjhB97XozMSkEwPXx7OVANaJEwLErkY1phUF"
- host = "https://eu.posthog.com"
+ host = "https://eu.i.posthog.com"
elif region == "US":
api_key = "sTMFPsFhdP1Ssg"
- host = "https://app.posthog.com"
+ host = "https://us.i.posthog.com"
if not api_key:
return
diff --git a/posthog/year_in_posthog/2023.html b/posthog/year_in_posthog/2023.html
index 54ff75cc4cb06..113ec1730c381 100644
--- a/posthog/year_in_posthog/2023.html
+++ b/posthog/year_in_posthog/2023.html
@@ -20,27 +20,7 @@