Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it easier to separate different websites #18863

Open
robbie-c opened this issue Nov 23, 2023 · 2 comments
Open

Make it easier to separate different websites #18863

robbie-c opened this issue Nov 23, 2023 · 2 comments
Assignees
Labels
enhancement New feature or request team/web-analytics

Comments

@robbie-c
Copy link
Collaborator

robbie-c commented Nov 23, 2023

Is your feature request related to a problem?

It's currently impossible to separate web and app traffic in some cases.

If they are on different hosts (domain or subdomain), this is relatively simple to do with the Host filter (and #18818 will help), but if the structure is something like...

Marketing pages:
http://www.example.com/pricing
http://www.example.com/features

Product
http://www.example.com/account
http://www.example.com/:projectId/dashboard

...then this is harder to do. If there were only a few pages one could use a regex, but this approach does not work if there are many pages. In this example, the marketing pages and the product could be completely separate sites, that are combined into the same subdomain using e.g. cloudflare.

We should also consider how the breakdowns should look, e.g. whether Top paths should just be the pathname, or whether we should include the full url.

Describe the solution you'd like

// in the marketing site
posthog.init(
    "SOME_API_KEY",
    {
        site_name: "marketing_site"
   }
)
// in the product site
posthog.init(
    "SOME_API_KEY",
    {
        site_name: "product_site"
   }
)
// in the iOS app
posthog.init(
    "SOME_API_KEY",
    {
        site_name: "ios_app"
   }
)

The API key is the same, as these are in the same project, so funnels etc work.

The site_name would get passed as a property with all events, and appears in in-sights and web analytics as a built-in property.

It could be pretty useful to have this as a built-in property for other reasons too, e.g. this would be useful as a filter in many trends, and it would be potentially useful to show users their quota usage by site_name.

Describe alternatives you've considered

Could use a super property instead, but that wouldn't work in web analytics where we don't support custom properties.

We might want a different name, as I imagine that this would be useful for the mobile sdks as well (i.e. not "site"s).

Additional context

https://posthog.slack.com/archives/C05LJK1N3CP/p1700666063561559

@robbie-c robbie-c added enhancement New feature or request team/web-analytics labels Nov 23, 2023
@robbie-c robbie-c self-assigned this Nov 23, 2023
@timgl
Copy link
Collaborator

timgl commented Nov 23, 2023

Could use a super property instead, but that wouldn't work in web analytics where we don't support custom properties.

We could just support this as a 'native' property, like we will with $browser etc? For that reason I'd suggest the property gets sent as $site_name too

@robbie-c
Copy link
Collaborator Author

robbie-c commented Dec 7, 2023

Let's do #12181 instead of the approach I suggested

@robbie-c robbie-c changed the title Make it easier to separate website and app Make it easier to separate different websites Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request team/web-analytics
Projects
None yet
Development

No branches or pull requests

2 participants