-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
55 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from posthog.utils import get_instance_region | ||
from posthog.cloud_utils import is_cloud | ||
|
||
|
||
def get_ph_client(): | ||
from posthoganalytics import Posthog | ||
|
||
if not is_cloud(): | ||
return | ||
|
||
# send EU data to EU, US data to US | ||
api_key = None | ||
host = None | ||
region = get_instance_region() | ||
if region == "EU": | ||
api_key = "phc_dZ4GK1LRjhB97XozMSkEwPXx7OVANaJEwLErkY1phUF" | ||
host = "https://eu.posthog.com" | ||
elif region == "US": | ||
api_key = "sTMFPsFhdP1Ssg" | ||
host = "https://app.posthog.com" | ||
|
||
if not api_key: | ||
return | ||
|
||
ph_client = Posthog(api_key, host=host) | ||
|
||
return ph_client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters